Hidden Markov Models for Functional Data

Fits hidden Markov models to time-ordered sequences of curves, such as sample paths of stochastic processes or smoothed functional observations, without projecting the curves onto a finite basis. The emission functions are Onsager-Machlup functionals of Gaussian measures on function spaces, which allows for Brownian motion with drift, fractional Brownian motion, Ornstein-Uhlenbeck processes and non-parametric state means under a choice of Cameron-Martin norm. The Baum-Welch and Viterbi algorithms are implemented in C. Methods are described in Kashlak, Loliencar and Heo (2023) < https://jmlr.org/papers/v24/22-0685.html>.


funHMM: Hidden Markov Models for Functional Data

funHMM fits topological hidden Markov models to time-ordered sequences of curves (functional data, sample paths of stochastic processes) without first projecting the curves onto a finite basis. The emission functions are Onsager-Machlup functionals of Gaussian measures on function spaces, as developed in

Kashlak, A. B., Loliencar, P. and Heo, G. (2023). Topological Hidden Markov Models. Journal of Machine Learning Research, 24(340), 1-49. https://jmlr.org/papers/v24/22-0685.html

Three emission models are available:

  • "bmwd": Brownian motion with a state-dependent linear drift, including fractional Brownian motion with a fixed Hurst parameter;
  • "ou": the Ornstein-Uhlenbeck process with state-dependent mean and mean-reversion rate;
  • "nonpar": non-parametric state mean curves under an L2, W21 (Sobolev) or W22 Cameron-Martin norm.

The Baum-Welch (EM) and Viterbi algorithms are implemented in C and run on the log scale, so they are fast and numerically stable for long sequences.

Installation

# from CRAN (once accepted)
install.packages("funHMM")

# from a source tarball
install.packages("funHMM_0.1.0.tar.gz", repos = NULL, type = "source")

Example

library(funHMM)
set.seed(137)
A <- matrix(0.09, 5, 5) + 0.55 * diag(5)          # transition matrix A1 of the paper
sim <- rthmm(200, init.prob = c(1, 0, 0, 0, 0), trans = A,
             type = "bmwd", par = c(-8, -4, 0, 4, 8), len = 100)

fit <- thmm(sim$data, nstates = 5, type = "bmwd")
fit
table(fit$states, sim$states)      # decoded vs true states
ari(fit$states, sim$states)        # adjusted Rand index
plot(fit)

See vignette("funHMM") for a tour of all three models that reproduces the simulation studies of the paper.

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("funHMM")

0.1.0 by Adam B Kashlak, 22 days ago


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


Authors: Adam B Kashlak [aut, cre]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports stats, graphics, grDevices

Suggests knitr, rmarkdown, testthat


See at CRAN