Function HMMLikelihood computes the log-likelihood via hmm.lnl which is a wrapper for the FORTRAN code hmm_like.f. The function HMMlikelihood is called from optimizer and it in turn calls hmm.lnl after setting up parameters.
For an R version of the HMMLikelihood and related code see R_HMMLikelihood
HMMLikelihood(par,type,xx,xstart,mx,T,freq=1,fct_dmat,fct_gamma,fct_delta,ddl,
dml,parameters,debug=FALSE,return.mat=FALSE,sup=NULL,check=FALSE)
reals(ddl,dml,parameters,parlist,indices=NULL)
hmm.lnl(x,start,m,T,dmat,gamma,delta,freq,debug)
HMMLikelihood returns log-likelihood for a single sequence and hmm.lnl returns the negative log-likelihood value for each capture history. reals returns either the column dimension of design matrix for parameter or the real parameter vector
vector of parameter values for log-likelihood evaluation
vector of parameter names used to split par vector into types
matrix of observed sequences (row:id; column:occasion/time); xx used instead of x to avoid conflict in optimx
for each ch, the first non-zero x value and the occasion of the first non-zero value; ; xstart used instead of start to avoid conflict in optimx
number of states; mx used instead of m to avoid conflict in optimx
number of occasions; sequence length
vector of history frequencies or 1
function to create D from parameters
function to create gamma - transition matrix
function to create initial state distribution
design data list of parameters for each id
list of design matrices; one entry for each parameter; each entry contains fe and re for fixed and random effects
formulas for each parameter type
if TRUE, print out par values and -log-likelihood
If TRUE, returns list of transition, observation and delta arrays.
list of supplemental information that may be needed by the function but only needs to be computed once; currently only used for MVMS models for dmat
if TRUE, checks validity of gamma, dmat and delta to look for any errors
same as xx but for call to hmm.lnl
same as mx but for call to hmm.lnl
observation probability matrices
transition matrices
initial distribution
list of parameter strings used to split par vector
same as xstart but for hmm.lnl
specific indices for computation unless NULL
Jeff Laake
Zucchini, W. and I.L. MacDonald. 2009. Hidden Markov Models for Time Series: An Introduction using R. Chapman and Hall, Boca Raton, FL. 275p.
R_HMMLikelihood