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.
Questions tagged [survival]
445 questions
1
vote
0 answers
Confidence interval from se.fit of the prediction of a weibull survreg model in R "survival"
I'd like to learn about how to get confidence interval from the prediction of value and standard error from a weibull survreg model in R "survival".
R doc for predict.survreg has an example showing a plot not only gives the fit of the prediction of…

Yiyin
- 75
- 2
- 9
1
vote
1 answer
Predicting WHEN an event is going to occur
I am very new to Machine learning and r, so my question might seem unclear or would need more information. I have tried to explain as much as possible. Please correct me if I have used wrong terminologies or phrases. Any help on this will be greatly…

Rashmi Shivanna
- 85
- 2
- 14
1
vote
2 answers
Get predictions from coxph
# Create the simplest test data set
test1 <- list(time=c(4,3,1,1,2,2,3),
status=c(1,1,1,0,1,1,0),
x=c(0,2,1,1,1,0,0),
sex=c(0,0,0,0,1,1,1))
# Fit a stratified model
m=coxph(Surv(time, status) ~ x +…

bvowe
- 3,004
- 3
- 16
- 33
1
vote
0 answers
ggsurvplot: Error in grDevices::col2rgb(colour, TRUE)
I have a dataframe like this
df = data.frame(time=c(1,2,3,4,1), event=c(1,1,0,0,1))
I want to create a survival curve
library(survival)
km <- survfit(Surv(time,event) ~ 1, data = df)
library("survminer")
ggsurvplot(km, color = "#2E9FDF",
…

Edward
- 4,443
- 16
- 46
- 81
1
vote
0 answers
Coxph vs. Flexsurvreg: contradictory predictions of covariate effects
I'm running a cox proportional hazard model on a heuristic dataset of operational delays given two covariates: cost and demand:
> dat.op
delay censor cost demand
1 2.875000 1 3.10 0.1
2 1.569444 1 0.68 0.1
3 2.000000 1 6.05 …

neither-nor
- 1,245
- 2
- 17
- 30
1
vote
1 answer
How can assign an offset term in coxph function in R, which later can be used in the "mstate" package?
I am trying to use mstate package in R, for which I have to use coxph function using strata command. Here is a sample code:
library(mstate)
tmat <- trans.illdeath()
tg <- data.frame(stt=rep(0,6),sts=rep(0,6),…

ssaha
- 459
- 2
- 10
1
vote
1 answer
Is there a way so that an already defined argument can appear as missing when using optim() function in R?
I am trying to get the Maximum Likelihood Estimators of the log-likelihood of a Gumbel distribution for survival analysis(i say that so that you dont get astranged by the log-likelihood function, i think its correct). In order to do that i have to…

nnisgia
- 37
- 5
1
vote
0 answers
Accelerated Failure Time model in PySpark to model recurring events
I am trying to predict the probabilities for a customer reordering an order cart from their order history by making use of Accelerated Failure Time model in PySpark.
My input data contains
various features of the customer and the respective order…

Rajesh
- 11
- 1
1
vote
1 answer
Error in coxModelFrame.coxph(object) : invalid object set x=TRUE in the call to coxph
The following example is for anyone who is building a Cox Proportional Hazards models and trying to produce prediction error curves, but get an error stating:
Error in coxModelFrame.coxph(object) : invalid object
set x=TRUE in the call to…

Brandon
- 51
- 1
- 7
1
vote
1 answer
How to create a co-variate time dependent to use in `coxph` model in survival package in r?
I have a data set like this:
id status time event

Guilherme Parreira
- 944
- 9
- 29
1
vote
1 answer
Survival Analysis: Number of Censored Events in Life Table
I want to construct a life table for some event of interest. See below for an example:
I'm trying to do this with survival R package: https://cran.r-project.org/web/packages/survival/survival.pdf.
library(survival)
surv <- Surv(veteran$time,…

cooldood3490
- 2,418
- 7
- 51
- 66
1
vote
1 answer
Adjusting yscale in terminal panel in survival ctree plot
I am using ctree() in package party/partykit to plot a survival tree of a survival model.
Overall survival is good, 95% survival at worst, so I would like to change the yscale to c(0.9, 1) so that the panels are useful on the final plot.
I need to…

JisL
- 161
- 8
1
vote
0 answers
MLR - Survival analysis with time-dependent data
I am using mlr and would like to be able to use the extended version of the Cox PH model for right-censored, time dependent covariates. This is what I have tried, following the vignette on time-dependent covariates …

panda
- 821
- 1
- 9
- 20
1
vote
1 answer
Aggregate dataframe by row difference in R
I have a dataframe which consists of the times when patients died.
It looks something like this
Time Alive Died Lost
0 375 0 2
0.0668 373 1 9
0.3265 363 2 12
0.6439 349 0 6
0.7978 343 2 1
0.8363 340 2 …

prophet
- 85
- 1
- 12
1
vote
1 answer
How to convert my data to counting process format with start stop times for interval truncation in R?
I would like to model a recurrent event with subjects that move in and out of risk over the course of the observation period of the study.
I have data on the out-of-risk periods (start and end dates) where the subject cannot experience the event.
I…

shitshimugi
- 11
- 3