Inference and Estimation of Hidden Markov Models and Hidden Semi-Markov Models

Provides flexible maximum likelihood estimation and inference for Hidden Markov Models (HMMs) and Hidden Semi-Markov Models (HSMMs), as well as the underlying systems in which they operate. The package supports a wide range of observation and dwell-time distributions, offering a flexible modelling framework suitable for diverse practical data. Efficient implementations of the forward-backward and Viterbi algorithms are provided via 'Rcpp' for enhanced computational performance. Additional functionality includes model simulation, residual analysis, non-initialised estimation, local and global decoding, calculation of diverse information criteria, computation of confidence intervals using parametric bootstrap methods, numerical covariance matrix estimation, and comprehensive visualisation functions for interpreting the data-generating processes inferred from the models. Methods follow standard approaches described by Guédon (2003) , Zucchini and MacDonald (2009, ISBN:9781584885733), and O'Connell and Højsgaard (2011) .


HMMHSMM

R-CMD-check

R Package for the estimation and inference of hidden Markov models and hidden semi-Markov models.

Initial setup

install.packages(c('pkgload', 'evd', 'extRemes', 'mnormt'))

Load the package with

library(devtools)
load_all('path/to/HMMHSMM')

where path/to is the path to the location where HMMHSMM resides.

Running a test case

library(HMMHSMM)
J <- 3
delta <- c(1,0,0)
Pi <- matrix(c(0.9, 0.05, 0.05,
               0.2,0.7, 0.1,
               0.05, 0.15, 0.8), byrow=TRUE, nrow=J)
obspar <- list(loc=c(-3, 5, 10), scale=c(1, 2, 4), shape=c(-0.2, 0.3, 0.5))

fulldata <- generateHMM(n=1000, J=J, obsdist="gev", obspar=obspar, Pi=Pi, delta=delta, seed=123)
data <- fulldata$x

t0 <- Sys.time()
model <- findmleHMMnostarting(J=J, x=data, obsdist="gev", no.initials=50, EM=TRUE, seed=123)
t1 <- Sys.time()

confint <- confintHMM(x=data, HMM=model, obsdist="gev", level=0.95, B=100, EM=TRUE, seed=123)

This will print

...
loglik at iter 20 : -2529.93799504314
loglik at iter 21 : -2529.93766554389
loglik at iter 22 : -2529.93766225114
function converged at iteration 22

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("HMMHSMM")

0.2.0 by Ting Wang, 10 hours ago


Browse source code at https://github.com/cran/HMMHSMM


Authors: Aimee Cody [aut] , Ting Wang [cre, ctb] (Research Supervisor)


Documentation:   PDF Manual  


GPL-3 license


Imports Rcpp, evd, extRemes, stats, MASS, mnormt, grDevices, graphics, utils, future.apply, future, parallelly

Suggests testthat, rcmdcheck, profvis

Linking to Rcpp


See at CRAN