trim_model: Trim Small Probabilities of Hidden Markov Model

View source: R/trim_hmm.R

trim_modelR Documentation

Trim Small Probabilities of Hidden Markov Model

Description

Function trim_model tries to set small insignificant probabilities to zero without decreasing the likelihood.

Usage

trim_model(
  model,
  maxit = 0,
  return_loglik = FALSE,
  zerotol = 1e-08,
  verbose = TRUE,
  ...
)

Arguments

model

Model of class hmm or mhmm for which trimming is performed.

maxit

Number of iterations. After zeroing small values, the model is refitted, and this is repeated until there is nothing to trim or maxit iterations are done.

return_loglik

Return the log-likelihood of the trimmed model together with the model object. The default is FALSE.

zerotol

Values smaller than this are trimmed to zero.

verbose

Print results of trimming. The default is TRUE.

...

Further parameters passed on to fit_model.

See Also

build_hmm and fit_model for building and fitting hidden Markov models; and hmm_biofam for information on the model used in the example.

Examples

data("hmm_biofam")

# Testing if changing parameter values smaller than 1e-03 to zero
# leads to improved log-likelihood.
hmm_trim <- trim_model(hmm_biofam, zerotol = 1e-03, maxit = 10)

seqHMM documentation built on July 9, 2023, 6:35 p.m.