simulate              package:depmixS4              R Documentation

_M_e_t_h_o_d_s _t_o _s_i_m_u_l_a_t_e _f_r_o_m (_d_e_p-)_m_i_x _m_o_d_e_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     Random draws from '(dep-)mix' objects.

_U_s_a_g_e:

       ## S4 method for signature 'depmix':
       simulate(object, nsim=1, seed=NULL, ...)
       
       ## S4 method for signature 'mix':
       simulate(object, nsim=1, seed=NULL, ...)

       ## S4 method for signature 'response':
       simulate(object, nsim=1, seed=NULL, times, ...)
       
       ## S4 method for signature 'GLMresponse':
       simulate(object, nsim=1, seed=NULL, times, ...)
       
       ## S4 method for signature 'transInit':
       simulate(object, nsim=1, seed=NULL, times, is.prior=FALSE, ...)

_A_r_g_u_m_e_n_t_s:

  object: Object to generate random draws.  An object of class 'mix',
          'depmix', 'response' or 'transInit'

    nsim: The number of draws (one draw simulates a data set of the
          size that is defined by ntimes); defaults to 1.

    seed: Set the seed.

   times: (optional) An indicator vector indicating for which times in
          the complete series to generate the data.  For internal use.

is.prior: For 'transInit' objects, indicates whether it is a prior 
          (init) model, or not (i.e., it is a transition model)

     ...: Not used currently.

_D_e_t_a_i_l_s:

     For a '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.

_V_a_l_u_e:

     For a 'depmix' object, a new object of class 'depmix.sim'. 

     For a 'transInit' object, a state sequence.

     For a 'response' object, an observation sequence.

_A_u_t_h_o_r(_s):

     Maarten Speekenbrink

_E_x_a_m_p_l_e_s:

     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)

