simmulti.msm(data, qmatrix, covariates=NULL, death = FALSE, start,
ematrix=NULL, hmodel=NULL, hcovariates=NULL)
time
,
representing observation times. The optional column named subject
,
corresponds to subject identification numbers. If not given, all
observations are assumed to be oqmatrix
is ignored,
and computed as appropriate so that the rows sum to zero. For
example, a possible qmatrix
msm
.msm
.hmodel
, defining any covariates
governing the hidden Markov outcome models. Unlike in the
msm
function, this should also define the values of the
covariate effects. Each element of the lematrix
or hmodel
was suppliedsim.msm
is called repeatedly to produce a simulated
trajectory for each individual. The state at each specified
observation time is then taken to produce a new column state
.
The effect of time-dependent covariates on the transition intensity
matrix for an individual is determined by assuming that the covariate is a step function
which remains constant in between the individual's observation times.
If the subject enters an absorbing state, then only the first
observation in that state is kept in the data frame. Rows corresponding to future
observations are deleted. The entry times into states given in
death
are assumed to be known exactly.sim.msm
### Simulate 100 individuals with common observation times
sim.df <- data.frame(subject = rep(1:100, rep(13,100)), time = rep(seq(0, 24, 2), 100))
qmatrix <- rbind(c(-0.11, 0.1, 0.01 ),
c(0.05, -0.15, 0.1 ),
c(0.02, 0.07, -0.09))
simmulti.msm(sim.df, qmatrix)
Run the code above in your browser using DataLab