depmix               package:depmixS4               R Documentation

_D_e_p_e_n_d_e_n_t _M_i_x_t_u_r_e _M_o_d_e_l _S_p_e_c_i_f_i_c_t_i_o_n

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

     'depmix' creates an object of class 'depmix', a dependent mixture
     model, otherwise known as hidden Markov model.  For a short
     description of the package see 'depmixS4'.

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

             
             depmix(response, data=NULL, nstates, transition=~1, family=gaussian(), 
                     prior=~1, initdata=NULL, respstart=NULL, trstart=NULL, instart=NULL,
                     ntimes=NULL,...)        
             

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

response: The response to be modeled; either a formula or a list  of
          formulae in the multivariate case; this interfaces to the glm
          distributions. See 'Details'.

    data: An optional data.frame to interpret the variables in the
          response and transition arguments.

 nstates: The number of states of the model.

transition: A one-sided formula specifying the model for the 
          transitions. See 'Details'.

  family: A family argument for the response. This must be a list of
          family's if the response is multivariate.

   prior: A one-sided formula specifying the density for the prior or
          initial state probabilities.

initdata: An optional data.frame to interpret the variables occuring in
          prior. The number of rows of this data.frame must be equal to
          the number of cases being modeled. See 'Details'.

respstart: Starting values for the parameters of the response models.

 trstart: Starting values for the parameters of the transition models.

 instart: Starting values for the parameters of the prior or initial
          state probability model.

  ntimes: A vector specifying the lengths of individual, ie
          independent, time series. If not specified, the responses are
          assumed to form a single time series. If the data argument
          has an attribute ntimes, then this is used.

     ...: Not used currently.

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

     The function 'depmix' creates an S4 object of class 'depmix',
     which needs to be fitted using 'fit' to optimize the parameters.

     The response model(s) are created by call(s) to 'response'
     providing the response formula and the family specifying the error
     distribution.  If response is a list of formulae, the 'response''s
     are assumed to be independent conditional on the latent state.

     The transitions are modeled as a multinomial logistic model for
     each state.  Hence, the transition matrix can be modeled as
     time-dependent, depending on predictors.  The prior density is
     also modeled as a multinomial logistic.  Both are created by calls
     to 'transInit'.

     Starting values may be provided by the respective arguments.  The
     order in which parameters must be provided can be easily studied
     by using the 'setpars' function.

     Linear constraints on parameters can be provided as argument to
     the 'fit' function.

     The print function prints the formulae for the response,
     transition and prior models along with their parameter values.

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

     'depmix' returns an object of class 'depmix' which has the
     following slots:

response: A list of a list of response models; the first index runs
          over states; the second index runs over the independent 
          responses in case a multivariate response is provided.

transition: A list of 'transInit' models, ie multinomial logistic
          models with length the number of states.

   prior: A multinomial logistic model for the initial state
          probabilities.

dens,trDens,init: See 'depmix-class' help for details.  For internal
          use.

stationary: Logical indicating whether the transitions are
          time-dependent or not; for internal use.

  ntimes: A vector containing the lengths of independent time series;
          if data is provided, sum(ntimes) must be equal to nrow(data).

 nstates: The number of states of the model.

   nresp: The number of independent responses.

   npars: The total number of parameters of the model.  Note: this is
          _not_ the degrees of freedom because there are redundancies
          in the parameters, in particular in the multinomial models
          for the transitions and prior probabilities.

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

     Ingmar Visser & Maarten Speekenbrink

_R_e_f_e_r_e_n_c_e_s:

     On hidden Markov models: Lawrence R. Rabiner (1989).  A tutorial
     on hidden Markov models and selected applications in speech
     recognition. _Proceedings of IEEE_, 77-2, p.  267-295.

     On latent class models: A. L. McCutcheon (1987).  _Latent class
     analysis_.  Sage Publications.

_S_e_e _A_l_s_o:

     'fit', 'transInit', 'response', 'depmix-methods' for accessor
     functions to 'depmix' objects.

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

     # create a 2 state model with one continuous and one binary response
     data(speed)
     mod <- depmix(list(rt~1,corr~1),data=speed,nstates=2,family=list(gaussian(),multinomial()))
     # print the model, formulae and parameter values
     mod

