r.HMM {MatrixHMM}R Documentation

Random Number Generation for Matrix-Variate Hidden Markov Models

Description

Generates random numbers for matrix-variate Hidden Markov Models (HMMs) based on matrix-variate normal, t, and contaminated normal distributions.

Usage

r.HMM(density, num, t, PI, M, U, V, IP, nu, alpha, eta)

Arguments

density

A character string specifying the distribution to use for the HMM. Possible values are: "MVN" for the matrix-variate normal distribution, "MVT" for the matrix-variate t-distribution, and "MVCN" for the matrix-variate contaminated normal distribution.

num

An integer specifying the number of random matrices to generate.

t

An integer specifying the number of time points.

PI

A matrix representing the transition probability matrix.

M

An array with dimensions p x r x k, where k is the number of states, containing the mean matrices.

U

An array with dimensions p x p x k, where k is the number of states, containing the row covariance (scale) matrices.

V

An array with dimensions r x r x k, where k is the number of states, containing the column covariance (scale) matrices.

IP

A numeric vector of length k containing the initial probability weights.

nu

A numeric vector of length k containing the degrees of freedom for each state in the MVT distribution.

alpha

A numeric vector of length k containing the proportion of typical points in each state for the MVCN distribution.

eta

A numeric vector of length k containing the inflation parameters for each state in the MVCN distribution.

Value

A list containing the following elements:

Y

An array with dimensions p x r x num x t containing the generated data.

obs.states

An num x t matrix containing the state memberships.

Examples

p <- 2
r <- 3
num <- 50
t <- 3
k <- 2
IP <- c(0.5, 0.5)
PI <- matrix(c(0.9, 0.1, 0.3, 0.7), nrow = k, ncol = k, byrow = TRUE)
M <- array(NA, dim = c(p, r, k))
M[,,1]<- matrix(c(0,1,1,
                 -1,-1.5,-1),nrow = p, ncol = r, byrow = TRUE)
M[,,2]<- M[,,1]+3
U <- array(NA, dim = c(p, p, k))
V <- array(NA, dim = c(r, r, k))
U[, , 1] <- U[, , 2] <- matrix(c(1.73, -0.59, -0.59, 2.52), nrow = p, ncol = p, byrow = TRUE)
V[, , 1] <- V[, , 2] <- matrix(c(0.69, 0.23, -0.03,
                                 0.23, 0.48,  0.16,
                                -0.03, 0.16,  0.88), nrow = r, ncol = r, byrow = TRUE)
nu <- c(4.5, 6.5)
simData <- r.HMM(density = "MVT", num = num, t = t, PI = PI,
                M = M, U = U, V = V, IP = IP, nu = nu)

[Package MatrixHMM version 1.0.0 Index]