initGHMM: Random Initialization for a Hidden Markov Model with...

Description Usage Arguments Value References Examples

Description

Function used to generate a hidden Markov model with continuous variables and random parameters. This method allows using the univariate version of a Gaussian Mixture Model when setting m = 1. The code for the methods with categorical values or discrete data can be viewed in "initHMM" and "initPHMM", respectively.

Usage

1
initGHMM(n,m)

Arguments

n

the number of hidden states to use.

m

the number of variables generated by the hidden states (Dimensionality of the bbserved vector).

Value

A "list" that contains the required values to specify the model.

Model

it specifies that the observed values are to be modeled as a Gaussian mixture model.

StateNames

the set of hidden state names.

A

the transition probabilities matrix.

Mu

a matrix of means of the observed variables (rows) in each states (columns).

Sigma

a 3D matrix that has the covariance matrix of each state. The number of slices is equal to the maximum number of hidden states.

Pi

the initial probability vector.

References

Cited references are listed on the RcppHMM manual page.

Examples

1
2
3
4
n <- 3
m <- 5
model <- initGHMM(n, m)
print(model)

Example output

Attaching package: 'RcppHMM'

The following object is masked from 'package:stats':

    setNames

$Model
[1] "GHMM"

$StateNames
[1] "x1" "x2" "x3"

$A
          [,1]       [,2]      [,3]
[1,] 0.3850967 0.07848957 0.5364137
[2,] 0.4632427 0.21443606 0.3223212
[3,] 0.4013862 0.22724452 0.3713693

$Mu
          [,1]      [,2]       [,3]
[1,] -4.287879 -8.052023 -2.6753357
[2,]  2.807856 -6.370422  5.7743707
[3,]  2.893671  3.842607 -0.2396861
[4,]  2.155135  9.059913  8.0559998
[5,] -9.001419  5.731653  5.3710692

$Sigma
, , 1

         [,1]     [,2]      [,3]      [,4]      [,5]
[1,] 44.96628 10.71199  92.02508  16.80684  35.08081
[2,] 10.71199 75.33942  38.46948  67.17811  40.63659
[3,] 92.02508 38.46948 317.92484 155.79331 244.79003
[4,] 16.80684 67.17811 155.79331 450.17115 264.00857
[5,] 35.08081 40.63659 244.79003 264.00857 476.24865

, , 2

          [,1]      [,2]      [,3]      [,4]     [,5]
[1,] 160.51755 183.31659  10.35411  76.87737  75.3215
[2,] 183.31659 246.45161  60.29914 191.18516 119.1682
[3,]  10.35411  60.29914  88.17759 163.15001 113.2332
[4,]  76.87737 191.18516 163.15001 612.38650 288.2347
[5,]  75.32150 119.16815 113.23317 288.23466 603.9064

, , 3

         [,1]      [,2]      [,3]      [,4]     [,5]
[1,] 110.1637 192.82466 149.63264  48.95360 160.9112
[2,] 192.8247 469.74905 380.43584  92.94779 404.4102
[3,] 149.6326 380.43584 311.48569  78.42035 335.3700
[4,]  48.9536  92.94779  78.42035 285.98342 422.0553
[5,] 160.9112 404.41016 335.37002 422.05533 981.4505


$Pi
          [,1]      [,2]     [,3]
[1,] 0.1219744 0.5339806 0.344045

RcppHMM documentation built on May 2, 2019, 8:56 a.m.