simulate.survreg {microsimulation} | R Documentation |
Simulate event times from a survreg object
Description
Simulate event times from a survreg object
Usage
## S3 method for class 'survreg'
simulate(object, nsim = 1, seed = NULL, newdata, t0 = NULL, ...)
Arguments
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) |
Value
vector of event times with nsim repeats per row in newdata
Examples
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)
[Package microsimulation version 1.4.3 Index]