simulate.survreg | R Documentation |
Simulate event times from a survreg object
## S3 method for class 'survreg'
simulate(object, nsim = 1, seed = NULL, newdata, t0 = NULL, ...)
object |
survreg object |
nsim |
number of simulations per row in newdata |
seed |
random number seed |
newdata |
data-frame for defining the covariates for the simulations. Required. |
t0 |
delayed entry time. Defaults to NULL (which assumes that t0=0) |
... |
other arguments (not currently used) |
vector of event times with nsim repeats per row in newdata
library(survival)
fit <- survreg(Surv(time, status) ~ ph.ecog + age + sex + strata(sex),
data = lung)
nd = transform(expand.grid(ph.ecog=0:1, sex=1:2), age=60)
simulate(fit, seed=1002, newdata=nd)
simulate(fit, seed=1002, newdata=nd, t0=500)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.