As we did with the KM curves, we can also produce separate plots for subsets of the data. We will do this by applying the regression coefficients we obtained previously to subsets of the data, with each subset containing an approximately equal number of rows. That way, we will be able to compare the density across groups:
- In the following code, we will first subset our original dataset (ChurnStudy) by gender
- Then we will score the new subsets by applying the coefficients of CoxModel.1
- We will then reduce the density of the plots by sampling 300 observations each from the males and females subsets
- Finally, we will plot the results
Run the following code to produce some interesting subsets of the survival ...