I would recommend not trying to use tt()
to fit continuous functions of time for your coefficients in this case. With smaller data sets that helps describe and adjust for the pattern of associations of predictors with outcome over time. But even after you've done that I don't think that you can use cox.zph()
to show that you "fixed" the proportional hazards (PH) problem. And with your large data set it seems to be impossible in practice, anyway, as you need to make up to 1627 copies (one per event time) of hundreds of thousands of data rows.
I'd recommend a few steps instead.
First, make sure that you are modeling continuous predictors flexibly, e.g. with regression splines, rather than as simple linear predictors. A poorly modeled continuous predictor can lead to apparent violation of PH, perhaps even for other predictors in the model.
Second, follow Frank Harrell's advice in a comment on a related question and do some data reduction to cut down on the number of predictors. With 135 predictors you would expect about 7 of them to show "significant" violations of PH at p < 0.05; I understand that you only found 15 violators despite your large number of cases.
As you aren't interested in most of the predictors except for the effects of levels of a treatment
, why use such a complicated model if you can adjust for the other predictors more simply? You are about at the limit of reliability for overfitting, with only about 12 events per predictor, so reducing the number of predictors could improve the precision of the parts of the model that you care most about. Section 4.7 of Harrell's course notes or book describes data-reduction methods that can simplify the model without biasing results; all of Chapter 4 deserves close study.
Third, if you still have a PH problem after that, try stratification instead of the tt()
function. Stratifying on levels of categorical predictors that fail PH should fix problems associated with them. You don't get regression coefficients for predictors on which you stratify, but if you're just adjusting for them you don't care about their coefficients.
To get hazard ratios you don't want to stratify your categorical treatment
levels of primary interest, but you can still use strata by time groups that interact with your multi-level treatment
predictor. That's described in Section 4.1 of the R survival time-dependence vignette. With time strata you can use cox.zph()
to evaluate PH.
If you use that approach to specify, say, 10 different time intervals you would only have to make 10 copies (at most, versus up to 1627 with tt()
) of each of your 100,000 cases. That would probably fit into your computer, fix the PH problem if you choose appropriate time intervals, and would show how hazard ratios for treatment
levels change with time, at whatever resolution you choose for the time intervals.