surv_cp | R Documentation |
Converts a data frame to counting process notation and allows for time-dependent variables to be introduced.
surv_cp(
data,
time.var,
status.var,
covars = setdiff(names(data), c(time.var, status.var))
)
data |
data frame with survival time, survival status, and other covariates |
time.var |
|
status.var |
|
covars |
other covariates to retain |
A data frame with events in counting process notation.
http://www.ddiez.com/teac/surv/
library('survival')
cp <- surv_cp(aml, 'time', 'status')
coxph(Surv(start, stop, status) ~ x, data = cp)
## compare to
coxph(Surv(time, status) ~ x, data = aml)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.