For Cox regression with all categorical predictors, I want to model time-dependent covariates (time*cov
in Proc PHREG
) to account for proportional hazard assumption violations. I am using the codes below with dummies for categorical predictors with >2 levels.
Proc phreg data=tem1s (where=(clinM ne '1'));
model time*event(0) = dps40 dps41 dps100 drcb drco dag55 dag65 dag75 dag85
dps40t dps41t dps100t dag55t dag65t dag75t dag85t /NODUMMYPRINT ties=Efron RL;
dps40t=dps40*time; dps41t=dps41*time; dps100t=dps100*time;
dgs44t=dgs44*time; dgs45t=dgs45*time; dgs53t=dgs53*time; dgs54t=dgs54*time;
hazardratio 'h11' dps40t; hazardratio 'h12' dps41t; hazardratio 'h13' dps100t;
hazardratio 'h71' dag55t; hazardratio 'h72' dag65t; hazardratio 'h73' dag75t;
hazardratio 'h74' dag85t;
prop_test: test dag55t, dag65t, dag75t, dag85t;
run;
Here are issues:
I get normal / small parameter estimates for some of main effects but high estimates for interactions for all time-dependent covariates (e.g., dag55=0.09
and dag55t=-1174
). I get very absurdly high SE of dummies for main effects and interactions for time-dependent variables (e.g., SE of dag55
and dag55t
are 326.442
and 326442
, respectively SE of time-dependent variables are multiplied by 1000
for all). Some of the hazard ratios are suspect or are not computed. All terms in the model have 1 DF. Estimates for other variables look normal and chi-squared for the global test of proportional hazards is very small. Log looks normal with no errors.
When I use log(time)
instead of time to create time-dependent variables, I get 0 DF for time interaction covariates. The log reads:
ERROR: An illegal argument is used in the function call in statement number 1 at line 2566 column 1.
The statement was:
1 (2566:1) dag55t = (dag55=0) * LOG( time=0 ).
The error goes away if I force time>0
in the where statement (I have time>0 for all observations) but 0 DF and no estimates for time interactions. Interestingly, SE and parameters for main effect terms for time dependent variables are normal (e.g., dag55 -0.02663
and 0.10444
(SE)) but a little different than when time is used while estimates for other covariates don't change. Also, in I use time gt 0
in the where
statement together with time for computing interaction, DF for interactions become 0 as with log(time)
.
How I can include time-dependent interactions in the model?