depmix-methods {depmixS4} | R Documentation |
'depmix' and 'mix' methods.
Description
Various methods for depmix
and mix
objects.
Usage
## 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",...)
Arguments
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. |
Value
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. |
Author(s)
Ingmar Visser
Examples
# 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
[Package
depmixS4 version 0.2-1
Index]