julian.bothe at elitepartner.de
2013-Jul-24 13:45 UTC
[R] prediction survival curves for coxph-models; how to extract the right strata per individual
Hello everyone, It somehow seems like a strange question, but I don't find the answer. I think my question is the same <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=user_nodes&u ser=23573> stephenb wanted to ask in January, but it seems he didn't get an answer (see http://r.789695.n4.nabble.com/obtainl-survival-curves-for-single-strata-td 4657177.html). My problem is: I have a coxph.model with several strata and other covariables. Now I want to fit the estimated survival-curves for new data, using survfit.coxph. But this returns a prediction for each stratum per individual. So if I have 15 new individuals and 10 strata, I have 150 fitted surivival curves (or if I don't use the subscripts I have 15 predictions with the curves for all strata pasted together) Is there any possibility to get only the survival curves for the stratum the new individual belongs to? I think the newstrata argument at survfit.coxph should do this, but trying to use the argument I get the message "Warning message: In survfit.coxph(coxph.3, newdata = activisale_join[1:15, ], na.action na.pass, : newstrata argument under construction, value ignored" (below the documentation for survfit.coxph) So did anyone a workaround? Or does anyone know a fast solution to automatically use the right subscripts? (beside the one supplied by Stephen, which seems to take a little bit too much time.) All the best Julian Ps.: I use survival in version 2.37-4 "newstrata" if the original coxph model had strata, should the predictions be for all strata, or only for those in newdata? The default for this is TRUE if either the id or individual argument is present, as these require strata for the resulting curves to make sense. Otherwise the default is FALSE, which means to ignore any strata variable in the newdata data set, and produce predicted survivals for the entire set of strata in the original model. In this case some components of the output will be matrices with one column for each row of newdata. [[alternative HTML version deleted]]
Terry Therneau
2013-Jul-26 14:11 UTC
[R] prediction survival curves for coxph-models; how to extract the right strata per individual
It would help me to give advice if I knew what you wanted to do with the new curves. Plot, print, extract? A more direct solution to your question will appear in the next release of the code, btw. Terry T. On 07/25/2013 05:00 AM, r-help-request at r-project.org wrote:> My problem is: > > > > I have a coxph.model with several strata and other covariables. > > Now I want to fit the estimated survival-curves for new data, using > survfit.coxph. > > But this returns a prediction for each stratum per individual. So if I > have 15 new individuals and 10 strata, I have 150 fitted surivival curves > (or if I don't use the subscripts I have 15 predictions with the curves > for all strata pasted together) > > > > Is there any possibility to get only the survival curves for the stratum > the new individual belongs to? > >