HMMSet: Set the parameters for the hidden Markov models

View source: R/RHmm.R

HMMSetR Documentation

Set the parameters for the hidden Markov models

Description

This function is used to create a HMMClass object which contains the parameters of the HMM. An HMM is described by an initial state probability vector, transition matrices and a distributionClass object.

Usage

    HMMSet(initProb, transMat, ...)

Arguments

initProb

The vector of probabilities of the initial state

transMat

The transition matrix of the hidden Markov chain. Since version 1.3.4 of RHmm, a list of transition matrices can be specified in order to define an inhomogeneous HMM.

...

Other parameters. See details.

Details

Typical usages are:

  • HMMSet(initProb, transMat, distribution)

  • HMMSet(initProb, transMat, dis="NORMAL", mean, var)

  • HMMSet(initProb, transMat, dis="NORMAL", mean, cov)

  • HMMSet(initProb, transMat, dis="MIXTURE", mean, var, proportion)

  • HMMSet(initProb, transMat, dis="DISCRETE", proba, labels=NULL)

The different arguments are:

distribution

The distributionClass object of the observations

dis

dis parameter. See distributionSet

mean

mean parameter. See distributionSet

var

var parameter. See distributionSet

cov

cov parameter. See distributionSet

proportion

proportion parameter. See distributionSet

proba

proba parameter. See distributionSet

labels

labels parameter. See distributionSet

Value

An ‘HMMClass’ class object with the following elements:

initProb

Initial state probabilities vector

transMat

Transition matrix

distribution

The distributionClass object which describes the conditional distribution. See distributionSet.

See Also

distributionSet

Examples

    # 3 hidden states Markov Model with univariate normal distributions
    # for the observations
    #   obs | hidden state = 1 are N(1, 1)
    #   obs | hidden state = 2 are N(-2, 2)
    #   obs | hidden state = 3 are N(5, 4)

        n_1d_3s <- distributionSet("NORMAL", c(1, -2, 5), c(1, 2, 4))
        initProb3 <- rep(1,3)/3
        transMat3 <- rbind(c(0.5, 0.4, 0.1), c(0.3, 0.4, 0.3),
            c(0.2, 0.1, 0.7))
        hmm1 <- HMMSet(initProb3, transMat3, n_1d_3s)
        # or directly
        hmm2 <- HMMSet(initProb3, transMat3, "NORMAL", mean=c(1, -2, 5),
            var=c(1, 2, 4))
 

RHmm documentation built on Nov. 30, 2023, 7:22 p.m.

Related to HMMSet in RHmm...