I am applying an extended Cox model with external time-dependent covariates. Here is a small example (df) which I borrowed and modified from Themeau and Grambsch's book, Modeling survival data : extending the Cox model (2001):
id start stop event trt bili albumin
1 0 188 0 1 1.8 2.54
1 188 372 0 1 1.6 2.88
1 372 729 0 1 1.7 2.80
1 729 1254 0 1 3.2 2.92
1 1254 1462 0 1 3.7 2.59
1 1462 1824 0 1 4.0 2.59
1 1824 1925 1 1 5.3 1.83
2 0 56 0 0 1.8 2.36
2 56 172 0 0 1.6 1.89
2 172 521 1 0 1.7 1.56
3 0 36 0 1 3.2 2.10
3 36 232 0 1 3.7 2.32
3 232 352 0 1 4.0 1.96
3 352 610 1 1 5.3 2.05
I would like to obtain the baseline hazard/survival function from the extended Cox model. In the classical Cox PH model which handles time-independent covariates, it seems that we can obtain the estimate of H(t) using the Nelson-Aalen estimator:
fit1<- coxph(Surv(time, event) ~ tidc's, data=df)
sfit<-survfit(fit1)
sfit$surv
H<- -log(sfit$surv)
H<- c(H, tail(H, 1))
I am wondering how to obtain the baseline hazard/survival function from the extended Cox model, when external time-dependent covariates are used instead? Could I use the similar method like this?
model_1<-coxph(Surv(start,stop,event) ~ treat+log(bili)+log(albumin),data=df)
mfit<-survfit(model_1)
mfit$surv
H1<- -log(mfit$surv)
H1<- c(H1, tail(H1, 1))
Thanks.