Learn R Programming

⚠️There's a newer version (1.1.0) of this package.Take me there.

hmmTMB

This R package implements flexible hidden Markov models, based on Template Model Builder (TMB): flexible state-dependent distributions, transition probability structures, random effects, and smoothing splines.

Preprint

Michelot, T. (2022). hmmTMB: Hidden Markov models with flexible covariate effects in R. arXiv:2211.14139.

Package installation

Install the package from Github using devtools,

devtools::install_github("TheoMichelot/hmmTMB")

Package documentation

To find help files for the methods implemented in the package, search for help using the name of the corresponding class, e.g.,

?MarkovChain
?Observation
?HMM

We describe functionalities of the package in several vignettes:

Copy Link

Version

Install

install.packages('hmmTMB')

Monthly Downloads

350

Version

1.0.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Theo Michelot

Last Published

January 11th, 2023

Functions in hmmTMB (1.0.0)

Observation

R6 class for HMM observation model
as_character_formula

Read formula with as.character without splitting
Dist

R6 class for probability distribution
bdiag_check

Create block diagonal matrix (safe version)
cov_grid

Grid of covariates
hmmTMB-package

hmmTMB: Fit Hidden Markov Models using Template Model Builder
find_re

Find s(, bs = "re") terms in formula
as_sparse

Transforms matrix to dgTMatrix
HMM

R6 class for hidden Markov model
MarkovChain

R6 class for HMM hidden process model
make_formulas

Process formulas and store in nested list
mvnorm_invlink

Multivariate Normal inverse link function
logsumexp

Log of sum of exponentials
mvnorm_link

Multivariate Normal link function
is_whole_number

Check if number of whole number
hmmTMB_cols

hmmTMB colour palette
make_matrices

Create model matrices
invmlogit

Multivarite inverse logit function
na_fill

Fill in NAs
logLik.HMM

logLik function for SDE objects
prec_to_cov

Get covariance matrix from precision matrix
quad_pos_solve

Solve for positive root of quadratic ax^2 + bx + c = 0 when it exists
strip_comments

Strip comments marked with a hash from a character vector
mlogit

Multivariate logit function
update.HMM

Update a model to a new model by changing one formula