(dep-)mix
objects.## S3 method for class 'depmix':
simulate(object, nsim=1, seed=NULL, ...)
## S3 method for class 'mix':
simulate(object, nsim=1, seed=NULL, ...)
## S3 method for class 'response':
simulate(object, nsim=1, seed=NULL, times, ...)
## S3 method for class 'GLMresponse':
simulate(object, nsim=1, seed=NULL, times, ...)
## S3 method for class 'transInit':
simulate(object, nsim=1, seed=NULL, times, is.prior=FALSE, ...)
mix
, depmix
, response
or transInit
transInit
objects, indicates whether it is a prior
(init) model, or not (i.e., it is a transition model)depmix
object, a new object of class depmix.sim
.
For a transInit
object, a state sequence.
For a response
object, an observation sequence.depmix
model, simulate generates nsim
random state
sequences, each of the same length as the observation sequence in the
depmix
model (i.e., sum(ntimes(object))
. The state
sequences are then used to generate nsim
observation sequences
of thee same length.
For a mix
model, simulate generates nsim
random class
assignments for each case. Those assigments are then used to generate
observation/response values from the appropriate distributions.
Setting the times
option selects the time points in the total
state/observation sequence (i.e., counting is continued over ntimes).
Direct calls of simulate with the times
option are not recommended.y <- rnorm(1000)
respst <- c(0,1,2,1)
trst <- c(0.9,0.1,0.1,0.9)
df <- data.frame(y=y)
mod <- depmix(y~1,data=df,respst=respst,trst=trst,inst=c(0.5,0.5),nti=1000,nst=2)
mod <- simulate(mod)
Run the code above in your browser using DataLab