depmix-methods {depmixS4} | R Documentation |
Various methods for depmix
and mix
objects.
## S4 method for signature 'depmix' logLik(object,method=c("fb","lystig","classification"),na.allow=TRUE) ## S4 method for signature 'mix' logLik(object,method=c("fb","lystig","classification"),na.allow=TRUE) ## S4 method for signature 'depmix.fitted.classLik' logLik(object,method=c("classification","fb","lystig"),na.allow=TRUE) ## S4 method for signature 'mix.fitted.classLik' logLik(object,method=c("classification","fb","lystig"),na.allow=TRUE) ## 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",...) ## S4 method for signature 'depmix' getmodel(object,which="response",state=1,number=1) ## S4 method for signature 'mix' getmodel(object,which="response",state=1,number=1)
object |
A |
values |
To be used in |
method |
The log likelihood can be computed by either the forward
backward algorithm (Rabiner, 1989), or by the method of Lystig and
Hughes, 2002. The former is the default and implemented in a fast
C routine. The forward-backward routine also computes the state and transition
smoothed probabilities, which are not directly neccessary for the log likelihood.
Those smoothed variables, and the forward and backward variables are accessible
through the |
na.allow |
Allow missing observations? When set to FALSE, the logLik method will return NA in the presence of missing observations. When set to TRUE, missing values will be ignored when computing the likelihood. When observations are partly missing (when a multivariate observation has missing values on only some of its dimensionis), this may give unexpected results. |
which |
|
state |
In |
number |
In |
... |
Not used currently. |
logLik |
returns a |
nobs |
returns the number of observations (used in computing the BIC). |
npar |
returns the number of paramaters of a model. |
freepars |
returns the number of non-redundant parameters. |
setpars |
returns a |
getpars |
returns a vector with the current parameter values. |
getmodel |
returns a submodel of a |
Ingmar Visser
# 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())) getmodel(mod,"response",2,1) getmodel(mod,"prior") # 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