Learn R Programming

HMMHSMM (version 0.1.0)

IC: Calculate Information Criteria for HMM/HSMM Models

Description

Computes information criteria (AIC3, AICu, HQC, BICadj) for Hidden Markov Models (HMM) or Hidden Semi-Markov Models (HSMM).

Usage

IC(data, model, type)

Value

Numeric value of the specified information criterion.

Arguments

data

Numeric vector of observations.

model

Fitted HMM or HSMM model object.

type

Character string: "AIC3", "AICu", "HQC", or "BICadj".

Author

Aimee Cody

Details

Automatically detects HMM vs HSMM models based on dwellparameters presence.

Information criteria formulas:

  • AIC3: \(-2 \log L + 3k\)

  • AICu: Unbiased AIC with finite sample correction

  • HQC: \(-2 \log L + 2k \log(\log n)\)

  • BICadj: \(-2 \log L + k \log n - k \log(2\pi)\)

where \(L\) is likelihood, \(k\) is number of parameters, \(n\) is sample size.

Examples

Run this code

J <- 3
Pi <- matrix(c(0.0, 0.6, 0.4,
               0.5, 0.0, 0.5,
               0.3, 0.7, 0.0), nrow = J, byrow = TRUE)

obspar <- list(
  mean = c(-2, 0, 3),
  sd   = c(1, 1.5, 2)
)

dwellpar <- list(
  lambda = c(3, 5, 4)
)

sim <- generateHSMM(n = 1000, J = J, obsdist = "norm",
                    dwelldist = "pois", obspar = obspar,
                    dwellpar = dwellpar, Pi = Pi)

fit <- findmleHSMM(x = sim$x, J = J, M = 100,
                   obsdist = "norm", dwelldist = "pois",
                   obspar = obspar, dwellpar = dwellpar,
                   Pi = Pi)

AIC3 <- IC(sim, fit, "AIC3")
AICu <- IC(sim, fit, "AICu")
HQC <- IC(sim, fit, "HQC")
BICadj <- IC(sim, fit, "BICadj")


Run the code above in your browser using DataLab