fitMod {countHMM}R Documentation

fitMod

Description

Estimates the parameters of a hidden Markov model using maximum penalized likelihood estimation. For details, see Adam et al. (2019).

Usage

fitMod(x,N=2,probs0=NULL,gamma0=NULL,delta0=NULL,stationary=TRUE,lambda=NULL,sup=NULL,m=3,
inflation=NULL)

Arguments

x

Vector containing the observed time series of counts.

N

Integer, number of states. Default is N=2.

probs0

Matrix with N columns which contains initial parameter values for the state-dependent probabilities for each count. If probs0=NULL (default), then the initial parameter values are generated automatically (not recommended).

gamma0

Initial parameter values for the transition probabilities of the Markov chain underlying the observed counts. Matrix with N rows and N columns. If gamma0=NULL (default), then the initial parameter values are generated automatically (not recommended).

delta0

Initial parameter values for the initial probabilities of the Markov chain underlying the observed counts. Vector of length N. If delta0=NULL (default), then the stationary distribution is used.

stationary

Logical, determines whether the initial distribution of the Markov chain underlying the observed counts is the stationary distribution. Default is stationary=TRUE.

lambda

Vector of length N which contains the smoothing parameters associated with the different state-dependent distributions. Default is lambda=rep(0,N).

sup

Integer, determines the upper bound of the support of the state-dependent distributions. If NULL (default), then the maximum of x is used.

m

Integer, order of the difference penalties. Default is m=3.

inflation

Count probabilities to be excluded from penalization (e.g. in the presence of zero-inflation). Default is inflation=NULL.

Value

An object of type countHMM.

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
x = read.table("http://www.hmms-for-time-series.de/second/data/earthquakes.txt")$V2
# model fitting
lambda = rep(10^4,2)
fitMod(x=x,lambda=lambda)

[Package countHMM version 0.1.0 Index]