Questions tagged [survival]

Survival analysis compares the statistical strength of predictors for events encoded as occuring or censored in concert with a time variable. It can be parametric or non-parametric.

445 questions
2
votes
1 answer

survival curves produced by survfit function in package survival

I am using the survfit function in the R package survival to create survival curves from a survfit.coxph object output by coxph. I have two methods for creating the curve which give different results. I believe the first is the correct answer, but I…
jpl2116
  • 55
  • 4
2
votes
1 answer

issues using survminer::ggsurvplot to plot many survival curves programmatically in r

I can plot a single Kaplan-Meier plot like below with ggsurvplot: library(survminer) library(survival) fit1 = survfit(Surv(time, status) ~ sex, data = lung) ggsurvplot(fit1, data = lung) However, I need to plot many KM plot programmatically. I need…
zesla
  • 11,155
  • 16
  • 82
  • 147
2
votes
0 answers

difficulties with newdata in predict.coxph

I have a data.frame named "df" with structure 'data.frame': 800 obs. of 4 variables: $ status: num 1 1 1 1 1 1 0 1 0 1 ... $ time : num 4.97 1.53 3.98 2.75 3.86 ... $ uo : chr "C" "B" "C" "B" ... $ q3 : Factor w/ 4 levels…
user1453488
  • 441
  • 1
  • 4
  • 4
2
votes
1 answer

Create a Weibull Probability Paper Plot in R

I am trying to create a base plot for a weibull probability plot. I have been exploring the survival package in R but have not found the exact tool I need yet. So far I have been able to recreate the plot I need by hand (which is terrible - tons of…
user9842212
2
votes
0 answers

Predict event probability (event of prepayment) given survreg model

I want to predict the cumulative risk of a prepayment for data from Q1 2016, where the loan grade was an A. I have data up to MOB (month on book) 27, but want to predict up to month 36. sr.a_q2_16 <-…
2
votes
0 answers

plot - adding text to residual plots to identify potential outliers in R

I have created residual plots using the plot function in R: # residual diagnostics par(mfrow =…
user1607
  • 531
  • 7
  • 28
2
votes
0 answers

Survival Analysis with time-varying covariates in R with the mlr package

is it possible to implement time-varying covariates in survival analysis with the mlr package like the method described in https://cran.r-project.org/web/packages/survival/vignettes/timedep.pdf?
2
votes
2 answers

How do I identifying the first zero in a group of ordered columns?

I'm trying to format a dataset for use in some survival analysis models. Each row is a school, and the time-varying columns are the total number of students enrolled in the school that year. Say the data frame looks like this (there are time…
Ryan Parsons
  • 119
  • 1
  • 9
2
votes
1 answer

Competing risk survival random forest with large data

I have a data set with 500,000 observations with events and a competing risk as well as a time-to-event variable (survival analysis). I want to run a survival random forest. The R-package randomForestSRC is great for it, however, it is impossible to…
Brigitte
  • 813
  • 11
  • 23
2
votes
1 answer

Linear regression survival plot - how to change position of failure (0) dots?

This is my first question I have posted on here so I apologize in advance if I do anything wrong. I am plotting nest survival against a habitat variable (in my case shrub cover surrounding nests) using ggplot2 in R, as outlined…
Tim
  • 23
  • 4
2
votes
0 answers

error in coxph.wtest when using survreg and weibull in survival package, R

I am using survreg function and weibull distribution to predict the survival time for the last row of my data, But I got the error message. My data is: Train <- data.frame(Sum=c(2,2,2,2,2), Days=c(21,21,21,21,21), …
Feng Chen
  • 2,139
  • 4
  • 33
  • 62
1
vote
1 answer

ggsurvplot expand limits not aligning plot and table?

I am generating a kaplan-meir with a number at risk table using ggsurvplot. I want my axes expanded which is shown in the graph. However, this then means that the table does not line up with the plot. I want the axes expanded in the table as well so…
krtbris
  • 344
  • 1
  • 9
1
vote
0 answers

How to change font size in ggcuminc

I am plotting a cumulative incidence plot of a competing risk model using the tidycmprsk package. I'd like to increase the font size of everything - the x and y axis tick labels, the legend, the p-value, and the legend of the risk table. How do I…
John Ryan
  • 343
  • 1
  • 9
1
vote
0 answers

Proportional Hazards for Interval2 censored data

I am trying to get proportional hazards for the survival object. survobj1_2 <- Surv(time = as.numeric(set_1_2$int_1), time2 = as.numeric(set_1_2$int_2), type = 'interval2') I have tried using coxph() but it does not deal with…
Hari
  • 41
  • 3
1
vote
1 answer

Overlaying Kaplan Meier plots with parametric survival plots

Kaplan Meier KMsufit1_2<-survfit(survobj1_2 ~ 1, data = set_1_2_grp) Parametric Survival Analysis Gamma1_2<-flexsurvreg(survobj1_2 ~ 1, data = set_1_2_grp, dist = 'gamma') gen_Gamma1_2<-flexsurvreg(survobj1_2 ~ 1, data = set_1_2_grp, dist =…
Hari
  • 41
  • 3