I have run Cox regression using the survival
package to calculate mortality hazard ratio of an exposure A. I have found that the age
variable violated the proportional hazard assumption (with cox.zph
) and used strata(age)
to stratify age in further models.
I need a parameter estimate of the age
variable, as well as the variance and the matrix of covariance (to calculate Rate Advancement Periods)... And I don't know where to find them!
Am I missing something or am I misunderstanding what strata
is doing?
Here is a reproducible example, using the lung
data from the survival
package.
library(survival)
I create the survival object and do a first Cox regression with non-stratified age variable.
lung$SurvObj <- with(lung, Surv(time, status == 2))
coxreg1 <- coxph(SurvObj ~ age + sex, data = lung)
So, I get coefficients, variance, and covariance matrix for the parameter estimates.
> coxreg1$coefficients
age sex
0.01704533 -0.51321852
> vcov(coxreg1)
age sex
age 8.506877e-05 8.510634e-05
sex 8.510634e-05 2.804217e-02
Now, if do a second regression with the stratified age variable, I don't get any coefficient estimates, variance or covariance.
coxreg2 <- coxph(SurvObj ~ strata(age) + sex, data = lung)
> coxreg2$coefficients
sex
-0.64471
> vcov(coxreg2)
sex
sex 0.0449369
Thanks for the help!
When you use a variable for stratification you don't get any coefficient estimate for it. Instead separate baseline hazards are estimated for the different age groups. The essence of a stratified cox regression is to fit a model that has a different baseline hazard in each stratum.