I'm currently working with accelerated time failure models. However, when I fit a model using survreg
in R, the predict
function only seems to return expected lifetime.
I'm wondering how one can use a fitted accelerated time failure model to predict probability of survival within a given time interval, conditional on covariates and time already survived.
That is, I would like to know:
Ideally, I would have a predict function that accepts a fitted model object, the times in question, and new data containing covariates as arguments. The function then returns probability of survival up to each time, i.e. the conditional survival function, for each observation in the new dataset.
Edit To make this reproducible:
lfit <- survreg(Surv(time, status) ~ ph.ecog, data=lung)
pct <- 1:98/100 # The 100th percentile of predicted survival is at +infinity
ptime <- predict(lfit, newdata=data.frame(ph.ecog=2), type='quantile',
p=pct)
ptime
contains the number of days associated with each percentile. I want the inverse: to supply a time value and get the probability of survival.