Skip to content
Prev 32304 / 398506 Next

survit function and cox model with frailty

On Tue, 20 May 2003 gc4 at duke.edu wrote:
Yes, it is statistically legitimate. No, survfit can't do it. You could do
it yourself by extracting the baseline cumulative hazard and multiplying
it by the coefficients


An example, using the data in example(frailty)
 data(kidney)
 kfit <- coxph(Surv(time, status)~ age + sex + disease + frailty(id),
kidney
)
 H<-basehaz(kfit,centered=FALSE)

 # three new data points
 temp <- kidney[1:3,c("age","sex","disease")]
 # model.matrix without intercept
 Mtemp <- model.matrix(~age+sex+disease,temp)[,-1]
 # fitted log hazard ratio
 logHR <- Mtemp%*%coef(kfit)[,1]
 # turn it into a vector, not matrix
 logHR <- drop(logHR)
 # Hazard ratio
 HR <- exp(logHR)

 # survival curves with frailty=1
 frail1 <- exp( -outer(H$hazard,HR))
 # survival curves with frailty=2
 frail2 <- exp( -outer(H$hazard,HR)*2)
 # survival curves with frailty=0.5
 frail.5 <- exp( -outer(H$hazard,HR)*0.5)




	-thomas