# NOT RUN {
d <- sampleData(1e2, outcome = "survival")
d$entry <- 0
##
library(survival)
mCox <- coxph(Surv(time, event) ~ X1+X2, data = d)
extractStrata(delete.response(mCox$terms), special = CoxSpecialStrata(mCox))
mCox <- coxph(Surv(event, time = entry, time2 = time) ~ strata(X1)+strata(X2), data = d)
extractStrata(delete.response(mCox$terms),
xlevels = mCox$xlevels, special = CoxSpecialStrata(mCox))
##
library(rms)
mCox <- cph(Surv(time, event) ~ X1+X2, data = d)
extractStrata(delete.response(mCox$terms), special = CoxSpecialStrata(mCox))
mCox <- cph(Surv(event, time = entry, time2 = time) ~ strat(X1)+strat(X2), data = d)
extractStrata(delete.response(mCox$terms),
xlevels = mCox$xlevels, special = CoxSpecialStrata(mCox))
# }
Run the code above in your browser using DataLab