mc_to_sc: Transform a Multichannel Hidden Markov Model into a Single...

View source: R/mc_to_sc.R

mc_to_scR Documentation

Transform a Multichannel Hidden Markov Model into a Single Channel Representation

Description

Transforms data and parameters of a multichannel model into a single channel model. Observed states (symbols) are combined and parameters multiplied across channels.

Usage

mc_to_sc(model, combine_missing = TRUE, all_combinations = FALSE, cpal)

Arguments

model

An object of class hmm or mhmm.

combine_missing

Controls whether combined states of observations at time t are coded missing (coded with * in stslists) if one or more of the channels include missing information at time t. Defaults to TRUE. FALSE keeps missing states as they are, producing more states in data; e.g. single/childless/* where the observation in channel 3 is missing.

all_combinations

Controls whether all possible combinations of observed states are included in the single channel representation or only combinations that are found in the data. Defaults to FALSE, i.e. only actual observations are included.

cpal

The color palette used for the new combined symbols. Optional in a case where the number of symbols is less or equal to 200 (in which case the seqHMM::colorpalette is used).

Details

Note that in case of no missing observations, the log-likelihood of the original and transformed models are identical but the AIC and BIC can be different as the model attribute df is recomputed based on the single channel representation.

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

# Loading a hidden Markov model of the biofam data (hmm object)
data("hmm_biofam")

# Convert the multichannel model to a single-channel model
sc <- mc_to_sc(hmm_biofam)

# Likelihoods of the single-channel and the multichannel model are the same
# (Might not be true if there are missing observations)
logLik(sc)
logLik(hmm_biofam)

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