nLogLike {countHMM} R Documentation

Penalized negative log-likelihood

Description

Computes the penalized negative log-likelihood using the forward algorithm as described in Adam et al. (2019). Not intended to be run by the user (internal function, called by the function fitMod).

Usage

nLogLike(parvect,x,N,stationary,lambda,sup,m,inflation)


Arguments

 parvect Vector of working parameters (as returned by pn2pw). x Vector of observed counts. N Integer, number of states. stationary Logical, determines whether the initial distribution of the Markov chain underlying the observed counts is the stationary distribution. lambda Vector of length N which contains the smoothing parameters associated with the different state-dependent distributions. sup Integer, determines the upper bound of the support of the state-dependent distributions. If NULL, then the maximum of x is used. m Integer, order of the difference penalties. inflation Count probabilities to be excluded from penalization (e.g. in the presence of zero-inflation).

Value

Numeric, the penalized negative log-likelihood.

References

Adam, T., Langrock, R., and Weiß, C.H. (2019): Penalized Estimation of Flexible Hidden Markov Models for Time Series of Counts. arXiv:https://arxiv.org/pdf/1901.03275.pdf.

Examples

# importing example data