coxph(formula, data=sys.parent(), subset,
na.action, weights, eps = 0.0001, init,
iter.max=10, method=c("efron","breslow","exact"),
singular.ok=T, robust,
model=F, x=F, y=T)
Therneau, T., Grambsch, P., and Fleming. T. (1990). Martingale based residuals for survival models. Biometrika 77, 147-160.
# Create the simplest test data set
test1 <- list(time=c(4,3,1,1,2,2,3),
status=c(1,1,1,0,1,1,0),
x=c(0,2,1,1,1,0,0),
sex=c(0,0,0,0,1,1,1))
# Fit a stratified model
coxph(Surv(time, status) ~ x + strata(sex), test1)
# Create a simple data set for a time-dependent model
test2 <- list(start=c(1,2,5,2,1,7,3,4,8,8),
stop=c(2,3,6,7,8,9,9,9,14,17),
event=c(1,1,1,1,1,1,1,0,0,0),
x=c(1,0,0,1,0,1,1,1,0,0))
summary(coxph(Surv(start, stop, event) ~ x, test2))
# Fit a stratified model, clustered on patients
bladder1 <- bladder
bladder1$start <- NULL
bladder1 <- bladder1[bladder1$enum < 5, ]
coxph(Surv(stop, event) ~ (rx + size + number) * strata(enum) +
cluster(id), bladder1, method='breslow')