Search code examples
rsurvival-analysiscox-regression

R predict.cox function type expected


I am using cox model for prediction.

fit <- coxph(Surv(time, status) ~ age + ph.ecog + strata(inst), lung)
predict(fit,type="expected")

In the predict.coxph doc, it says type expected is 'the expected number of events given the covariates and follow-up time'. What is the follow-up time means here? How can I change it?


Solution

  • This is an example of the "expected" for one particular set of patient features with a single time chosen to be greater than the mean survival time for this cohort, but using all the unique institution codes for the 'lung' dataset.

     (pr.fit.new <- predict(fit, newdata=data.frame(age=50, time=365, status=0, 
                                    ph.ecog=2,inst=unique(lung$inst[!is.na(lung$inst)]) ),
                            type="expected"))
     [1] 1.1886094 1.7679429 1.6651195 1.3117278 0.7743925 0.8501810
     [7] 1.9686954 1.2560981 2.5845069 0.6513932 1.1241870 1.1515346
    [13] 1.1616482 1.9071766 4.2468797 0.4921904 0.5875339 0.5647238
    

    The strata have remarkably different "baseline hazards" which produces material differences in the "expected" for hypothetical persons with the same covariate and period of observation.