generateHMM: generateHMM

Description Usage Arguments Details Value Examples

View source: R/generateHMM.R

Description

generateHMM generates multiple trajectures of observed chain X according to the hidden Markov model.

Usage

1
2
3
generateHMM(num, n = 100, trans = matrix(c(0, 3, 7, 5, 2, 3, 5, 5, 0),
  3, 3, byrow = TRUE)/10, u = c(-5, 0, 5), sig = c(1, 1, 1),
  pi0 = c(1, 1, 1)/3)

Arguments

num

number of Markov chains

n

length of Markov chain (assume all chains have equal length)

trans

a matrix of transition probability

u

emission prob: mean. For the rest of arguments, the dimension must match with trans.

sig

emission prob: standard deviation.

pi0

initial probability.

Details

Assumes hidden Markov model, the emmision probability follows normal distribution.

Value

A list containing:

Examples

1
2
set.seed(1221)
df <- generateHMM(num=2,n=10); df

jiangrongo/HMM documentation built on May 19, 2019, 9:38 p.m.