Skip to contents

Creates an object of class excodeModel for modeling excess counts using a Hidden Markov Model (HMM) with user-defined emission distributions and formula for modeling observed counts.

Usage

excodeModel(
  family,
  formula,
  initial_mu = NULL,
  transMat = NULL,
  initProb = NULL,
  transMat_prior = TRUE,
  setBckgState = TRUE
)

Arguments

family

An excodeFamily object defining the emission distribution (e.g., Poisson, Negative Binomial).

formula

An excodeFormula object specifying the structure of the model (e.g., time trends, seasonality, ...).

initial_mu

Initial estimates of the mean for 'MultiState' models.

transMat

Inital transition probabilities.

initProb

A numeric vector containing initial state probabilities (probabilities of of states at first time point) of the hidden Markov model.

transMat_prior

Logical. Should a prior distribution be used for estimating transition probabilities? Default is TRUE.

setBckgState

Logical. Should a background state be inferred for model fitting? Background states are initialized to 0 for time points with Anscombe residuals < 1 from an initial model. Default is TRUE.

Value

An object of class excodeModel.

Examples

# Initialisation of a mean model without timetrend with Poisson emission

excode_formula_mean <- excodeFormula("Mean", timeTrend = FALSE)
excode_family_pois <- excodeFamily("Poisson")
excodeModel(excode_family_pois, excode_formula_mean)
#> Inital excodeModel
#>  excodeFamily: Poisson
#>  excodeFormula: Mean
#> No. of timepoints: 0