simulate-methods {rstpm2}R Documentation

Simulate values from an stpm2 or pstpm2 fit

Description

Given an stpm2 fit and a data-frame of new data, return simulated values

Usage

    ## S4 method for signature 'stpm2'
simulate(object, nsim=1,
        seed=NULL, newdata=NULL,
        lower=1e-06, upper=1e+05, start=NULL, ...)
    ## S4 method for signature 'pstpm2'
simulate(object, nsim=1,
        seed=NULL, newdata=NULL,
        lower=1e-06, upper=1e+05, start=NULL, ...)

Arguments

object

an stpm2 or pstpm2 object

nsim

number of simulations per row in newdata

seed

optional random number seed

newdata

list of new data. If not specified, then defaults to object@data

lower

smallest possible time

upper

largest possible time

start

left truncated entry time (assumed to be zero if NULL)

...

additional arguments (for generic compatibility)

Methods

object = "stpm2"

an stpm2 fit

Examples

set.seed(1002)
fit1 <- gsm(Surv(rectime,censrec==1)~hormon,data=brcancer,df=3)
simulate(fit1, nsim=10, newdata=data.frame(hormon=1))
simulate(fit1, newdata=data.frame(hormon=0:1))


[Package rstpm2 version 1.6.3 Index]