[R] Cox model with time-dependent coefficients

Theresa Grimm Theresa.Grimm92 at gmx.de
Fri Aug 11 09:58:04 CEST 2017


Dear R-help Community,

I'm currently struggling with some issues extending the proportional Cox model with time-dependent coefficients and could really need some help.

Since I'm not experienced in adding code in an email in a nice way I add the link to my question and code: 

https://stats.stackexchange.com/questions/297052/time-dependend-coefficients-in-a-cox-model

Essentially, I try to predict the time to default in a credit scoring context using six categorical variables with survival analysis.

To extend the basic proportional Cox model I introduce time-dependent coefficients using a step function beta(t) according to Therneau et al. "Using time depended covariates and time depended coefficients in the Cox model".  
First question is: how to get the overall test for each categorical variable after applying the Cox.zph function.

The second, and currently more important question for me is:
After fitting my model based on a training set is it possible to make a prediction based on a new testset? Since I use an interaction between the covariate BS24 and the stratification by time group on the right handside of my formula (see code in link), I'm a bit confused how prediction is going to work. At the initial time t=0 I have no idea of the future particularly in which time group the new customer will be. 
To compare my models I use the time depended AUC calculated by the "score" function from package riskRegression. It internally uses a prediction function but when applying it to the extended model and the new test set it says "strata(time group) not found". 

When splitting my test set with survSplit the same way I did for the training set, it works and I get a nice AUC plot. But I am afraid if this actually makes sense and I don't wrongly include future information I usually don't have.

I'm thankful for any help or hint.


Kind regards
Theresa



More information about the R-help mailing list