HMMLikelihood: Hidden Markov Model likelihood functions

Description Usage Arguments Value Author(s) References See Also

View source: R/HMMLikelihood.r

Description

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

Usage

1
2
3
4
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)

Arguments

par

vector of parameter values for log-likelihood evaluation

type

vector of parameter names used to split par vector into types

xx

matrix of observed sequences (row:id; column:occasion/time); xx used instead of x to avoid conflict in optimx

xstart

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

mx

number of states; mx used instead of m to avoid conflict in optimx

T

number of occasions; sequence length

freq

vector of history frequencies or 1

fct_dmat

function to create D from parameters

fct_gamma

function to create gamma - transition matrix

fct_delta

function to create initial state distribution

ddl

design data list of parameters for each id

dml

list of design matrices; one entry for each parameter; each entry contains fe and re for fixed and random effects

parameters

formulas for each parameter type

debug

if TRUE, print out par values and -log-likelihood

return.mat

If TRUE, returns list of transition, observation and delta arrays.

sup

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

check

if TRUE, checks validity of gamma, dmat and delta to look for any errors

x

same as xx but for call to hmm.lnl

m

same as mx but for call to hmm.lnl

dmat

observation probability matrices

gamma

transition matrices

delta

initial distribution

parlist

list of parameter strings used to split par vector

start

same as xstart but for hmm.lnl

indices

specific indices for computation unless NULL

Value

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

Author(s)

Jeff Laake

References

Zucchini, W. and I.L. MacDonald. 2009. Hidden Markov Models for Time Series: An Introduction using R. Chapman and Hall, Boca Raton, FL. 275p.

See Also

R_HMMLikelihood


marked documentation built on Dec. 9, 2019, 9:06 a.m.