Learn R Programming

LaMa - Latent Markov model toolbox

Copy Link

Version

Install

install.packages('LaMa')

Monthly Downloads

325

Version

2.1.2

License

MIT + file LICENSE

Maintainer

Jan-Ole Fischer

Last Published

July 25th, 2026

Functions in LaMa (2.1.2)

generator

Build the generator matrix of a continuous-time Markov chain
make_matrices

Build the design and the penalty matrix for models involving penalised splines based on a formula and a data set
logLik.LaMaModel

Extract log-likelihood from LaMaModel object
logLik.qremlModel

Extract log-likelihood from qremlModel object
minmax

AD-compatible minimum and maximum functions
make_matrices_old

Build the design and the penalty matrix for models involving penalised splines based on a formula and a data set
minmax0_smooth

Smooth approximations to max(x, 0) and min(x, 0)
plot.LaMaResiduals

Plot pseudo-residuals
nessi

Loch Ness Monster Acceleration Data
penalty_uni

Penalty approximation of unimodality constraints for univariates smooths
penalty

Computes penalty based on quadratic form
report

Get reported quantities from and RTMB object and return a LaMaModel
penalty2

Computes generalised quadratic-form penalties
stationary

Compute the stationary distribution of a homogeneous Markov chain
process_hid_formulas

Process and standardise formulas for the state process of hidden Markov models
pseudo_res

Calculate pseudo-residuals
pred_matrix

Build the prediction design matrix based on new data and model_matrices object created by make_matrices
qreml

Quasi restricted maximum likelihood (qREML) algorithm for models with penalised splines or simple i.i.d. random effects
sdreport_outer

Report uncertainty of the estimated smoothing parameters or variances
make_matrices_dens

Build a standardised P-Spline design matrix and the associated P-Spline penalty matrix
skewnorm

Skew normal distribution
qreml_old

Quasi restricted maximum likelihood (qREML) algorithm for models with penalised splines or simple i.i.d. random effects
tpm_g

Build all transition probability matrices of an inhomogeneous HMM
stationary_ct

Compute the stationary distribution of a continuous-time Markov chain
tpm_g2

Build all transition probability matrices of an inhomogeneous HMM
sdreportMC

Monte Carlo version of sdreport
stateprobs_p

Calculate conditional local state probabilities for periodically inhomogeneous HMMs
stateprobs_g

Calculate conditional local state probabilities for inhomogeneous HMMs
tpm_emb_g

Build all embedded transition probability matrices of an inhomogeneous HSMM
tpm_emb

Build the embedded transition probability matrix of an HSMM from unconstrained parameter vector
predict.LaMa_matrices

Build the prediction design matrix based on new data and model_matrices object created by make_matrices
trex

T-Rex Movement Data
tpm_ct

Calculate continuous time transition probabilities
tpm_thinned

Compute the transition probability matrix of a thinned periodically inhomogeneous Markov chain.
stationary_p

Periodically stationary distribution of a periodically inhomogeneous Markov chain
tpm

Build the transition probability matrix from unconstrained parameter vector
tpm_hsmm2

Build the transition probability matrix of an HSMM-approximating HMM
smooth_dens_construct

Build the design and penalty matrices for smooth density estimation
tpm_hsmm

Builds the transition probability matrix of an HSMM-approximating HMM
tpm_p

Build all transition probability matrices of a periodically inhomogeneous HMM
stateprobs

Calculate conditional local state probabilities in HMMs
tpm_ihsmm

Builds all transition probability matrices of an inhomogeneous-HSMM-approximating HMM
tpm_phsmm

Builds all transition probability matrices of an periodic-HSMM-approximating HMM
stationary_p_sparse

Sparse version of stationary_p
tpm_phsmm2

Build all transition probability matrices of an periodic-HSMM-approximating HMM
viterbi_g

Viterbi algorithm for state decoding in inhomogeneous HMMs
trigBasisExp

Compute the design matrix for a trigonometric basis expansion
stationary_sparse

Sparse version of stationary
viterbi

Viterbi algorithm for state decoding in HMMs
summary.qremlModel

Summary method for qremlModel objects
vm

Von Mises distribution
viterbi_p

Viterbi algorithm for state decoding in periodically inhomogeneous HMMs
wrpcauchy

Wrapped Cauchy distribution
zero_inflate

Zero-inflated density constructer
cosinor

Trigonometric basis expansion
MCreport

Sample parameters from approximate Gaussian posterior distribution
forward_g

Forward algorithm with time-varying transition probability matrix
calc_trackInd

Calculate the index of the first observation of each track based on an ID variable
forward

Forward algorithm to calculate the HMM log-likelihood
dgmrf2

Reparametrised multivariate Gaussian distribution
forward_hsmm

Forward algorithm for homogeneous hidden semi-Markov models
LaMa-package

LaMa: Fast Numerical Maximum Likelihood Estimation for Latent Markov Models
LaMaColors

Generate a colour-blind-friendly palette
ddwell

State dwell-time distributions of periodically inhomogeneous Markov chains
forward_sp

Forward algorithm for hidden semi-Markov models with periodically varying transition probability matrices
generator_g

Build generator matrices of a continuous-time Markov chain
forward_ihsmm

Forward algorithm for hidden semi-Markov models with inhomogeneous state durations and/ or conditional transition probabilities
gamma2

Reparametrised gamma distribution
forward_phsmm

Forward algorithm for hidden semi-Markov models with periodically inhomogeneous state durations and/ or conditional transition probabilities
forward_p

Forward algorithm with for periodically varying transition probability matrices
gdeterminant

Computes generalised determinant
%sp%

Sparsity-retaining matrix multiplication
forward_s

Forward algorithm for hidden semi-Markov models with homogeneous transition probability matrix