depmix-methods           package:depmixS4           R Documentation

'_d_e_p_m_i_x' _a_n_d '_m_i_x' _m_e_t_h_o_d_s.

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

     Various methods for 'depmix' and 'mix' objects.

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

             
             ## S4 method for signature 'depmix':
             logLik(object,method="lystig")
             ## S4 method for signature 'mix':
             logLik(object,method="lystig")
             
             ## S4 method for signature 'depmix':
             nobs(object, ...)
             ## S4 method for signature 'mix':
             nobs(object, ...)
             
             ## S4 method for signature 'depmix':
             npar(object)
             ## S4 method for signature 'mix':
             npar(object)
             
             ## S4 method for signature 'depmix':
             freepars(object)
             ## S4 method for signature 'mix':
             freepars(object)
             
             ## S4 method for signature 'depmix':
             setpars(object,values, which="pars",...)
             ## S4 method for signature 'mix':
             setpars(object,values, which="pars",...)
             
             ## S4 method for signature 'depmix':
             getpars(object,which="pars",...)     
             ## S4 method for signature 'mix':
             getpars(object,which="pars",...)        

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

  object: A 'depmix' or 'mix' object.

  values: To be used in 'setpars' to set new parameter values; see the
          example.

  method: The log likelihood can be computed by either the forward
          backward algorithm from Rabiner, 1989, or by the method of
          Lystig and Hughes, 2002.  The latter is the default as it is
          faster because in the forward backward routine the state and
          transition smoothed probabilities are also computed which are
          not neccessary for the log likelihood.  Those smoothed
          variables, and the forward and backward variables are
          accessible through the 'forwardbackward' function.

   which: The default "pars" returns a vector of all parameters of a

          'depmix' object; the alternative value "fixed" return a
          logical vector of the same length indicating which parameters
          are fixed.  The setpars functions sets parameters (or the
          logical fixed vector) to new values; 'setpars' also
          recomputes the dens, trans and init slots of 'depmix'
          objects.  Note that the 'getpars' and 'setpars' functions for
          'depmix' objects simply call the functions of the same name
          for the response and transition models.

     ...: Not used currently.

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

  logLik: returns a 'logLik' object with attributes 'df' and 'nobs'.

    nobs: returns the number of observations (used in computing the
          BIC).

    npar: returns the number of paramters of a model.

freepars: returns the number of non-fixed parameters.

 setpars: returns a '(dep-)mix' object with new parameter values.

 getpars: returns a vector with the current parameter values.

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

     Ingmar Visser

_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()))

     # get the loglikelihood of the model
     logLik(mod)

     # to see the ordering of parameters to use in setpars
     mod <- setpars(mod, value=1:npar(mod))
     mod

     # to see which parameters are fixed (by default only baseline parameters in
     # the multinomial logistic models for the transition models and the initial
     # state probabilities model
     mod <- setpars(mod, getpars(mod,which="fixed"))
     mod

