Survival analysis is the statistics of censored time to event data, to which standard regression and classification techniques generally do not apply, due to the uncertain group memberships of the observations. The name originated from biological systems where the outcome of interest was indeed survival or death, but the concept applies equally well to mechanical failure, economic events or other types of prognostication.
Questions tagged [survival-analysis]
1244 questions
395
votes
1 answer
Representing Parametric Survival Model in 'Counting Process' form in JAGS
I'm trying to build a survival model in JAGS that allows for time-varying covariates. I'd like it to be a parametric model — for example, assuming survival follows the Weibull distribution (but I'd like to allow the hazard to vary, so exponential is…

jwdink
- 4,824
- 5
- 18
- 20
37
votes
5 answers
How to plot the survival curve generated by survreg (package survival of R)?
I’m trying to fit and plot a Weibull model to a survival data. The data has just one covariate, cohort, which runs from 2006 to 2010. So, any ideas on what to add to the two lines of code that follows to plot the survival curve of the cohort of…

rm.
- 509
- 1
- 6
- 8
19
votes
1 answer
R coxph() warning: Loglik converged before variable
I'm having some trouble using coxph().
I've two categorical variables: Sex and Probable Cause, that I want to use as predictor variables. Sex is just the typical male/female but Probable Cause has 5 options.
I don't know what is the problem with the…

JMarcelino
- 904
- 4
- 13
- 30
16
votes
2 answers
Plot survival and hazard function of survreg using curve()
I have the following survreg model:
Call:
survreg(formula = Surv(time = (ev.time), event = ev) ~ age,
data = my.data, dist = "weib")
Value Std. Error z p
(Intercept) 4.0961 0.5566 7.36 1.86e-13
age 0.0388 …
user1252482
15
votes
1 answer
Survival not recognizing right censored data
I'm trying to run a survival analysis in R using the survival package. I have right-censored data only (time to event, then event "1" or censor "0"). I created a survival object using the Surv function. However, survdiff and coxph give errors,…

C.C.
- 153
- 1
- 1
- 4
14
votes
2 answers
Using a survival tree from the 'rpart' package in R to predict new observations
I'm attempting to use the "rpart" package in R to build a survival tree, and I'm hoping to use this tree to then make predictions for other observations.
I know there have been a lot of SO questions involving rpart and prediction; however, I have…

jwdink
- 4,824
- 5
- 18
- 20
14
votes
1 answer
coxph() X matrix deemed to be singular;
I'm having some trouble using coxph(). I've two categorical variables:"tecnologia" and "pais", and I want to evaluate the possible interaction effect of "pais" on "tecnologia"."tecnologia" is a variable factor with 2 levels: gps and convencional.…

JMarcelino
- 904
- 4
- 13
- 30
13
votes
3 answers
How to compute the mean survival time
I'm using the survival library. After computing the Kaplan-Meier estimator of a survival function:
km = survfit(Surv(time, flag) ~ 1)
I know how to compute percentiles:
quantile(km, probs = c(0.05,0.25,0.5,0.75,0.95))
But, how do I compute the…

isekaijin
- 19,076
- 18
- 85
- 153
13
votes
3 answers
How to get survdiff returned p value
I am using R survival package, survdiff function. I wonder how to get the p value from the return value.
> diff = survdiff(Surv(Time, Censored) ~ Treatment+Gender, data = dat)
> diff
Call:
survdiff(formula = Surv(Time, Censored) ~ Treatment +…

tsznxyz
- 199
- 1
- 7
13
votes
4 answers
neuralnet prediction returns the same values for all predictions
I'm trying to build a neural net with the neuralnet package and I'm having some trouble with it. I've been successful with the nnet package but no luck with the neuralnet one. I have read the whole documentation package and can't find the solution,…

Rwak
- 316
- 1
- 3
- 11
12
votes
2 answers
How to interpret output of .predict() from fitted scikit-survival model in python?
I'm confused how to interpret the output of .predict from a fitted CoxnetSurvivalAnalysis model in scikit-survival. I've read through the notebook Intro to Survival Analysis in scikit-survival and the API reference, but can't find an explanation.…

Max Power
- 8,265
- 13
- 50
- 91
11
votes
1 answer
Survival on binned data
I have binned data I'm trying to perform a survival analysis on, example data below. n is a count of units at each group, time, failure indicator combination.
> df <- structure(list(group = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L,…

bigjim
- 938
- 1
- 9
- 18
11
votes
1 answer
Confidence intervals of the muhaz package hazard function
The muhaz package estimates the hazard function from right censored data using kernel smoothing methods. My question is, is there any way to obtain confidence intervals for the hazard function that muhaz calculates?…

ECII
- 10,297
- 18
- 80
- 121
11
votes
1 answer
R survival package; plotting log(-log(survival)) against log(time)
I'm trying to use the R survival package, to produce a plot of log(-log(survival)) against log(time)
(This is something sometimes recommended as a way to visually inspect for accelerated lifetime or proportional hazard properties).
The…

James Martin
- 213
- 1
- 2
- 6
11
votes
2 answers
How to extract values from survfit object
I've created this model:
model <- survfit(Surv(time,status)~c$sex)
model
and the output is:
Call: survfit(formula = Surv(time, status) ~ c$sex)
records n.max n.start events median 0.95LCL 0.95UCL
c$sex=female 15 15 15 …

JMarcelino
- 904
- 4
- 13
- 30