Learn R Programming

HMMextra0s (version 1.1.0)

sim.hmm0norm: Simulation of a 1-D HMM with Extra Zeros

Description

Simulates the observed process and the associated binary variable of a 1-D HMM with extra zeros.

Usage

sim.hmm0norm(mu, sig, pie, gamma, delta, nsim = 1, seed = NULL)

Arguments

pie

is a vector of length \(m\), the \(j\)th element of which is the probability of \(Z=1\) when the process is in state \(j\).

gamma

is the transition probability matrix (\(m * m\)) of the hidden Markov chain.

mu

is a \(1 * m\) matrix, the \(j\)th element of which is the mean of the (Gaussian) distribution of the observations in state \(j\).

sig

is a \(1 * m\) matrix, the \(j\)th element of which is the standard deviation of the (Gaussian) distribution of the observations in state \(j\).

delta

is a vector of length \(m\), the initial distribution vector of the Markov chain.

nsim

is an integer, the number of observations to simulate.

seed

is the seed for simulation. Default seed=NULL.

Value

x

is the simulated observed process.

z

is the simulated binary data with the value 1 indicating that an event was observed and 0 otherwise.

mcy

is the simulated hidden Markov chain.

References

Wang, T., Zhuang, J., Obara, K. and Tsuruoka, H. (2016) Hidden Markov Modeling of Sparse Time Series from Non-volcanic Tremor Observations. Journal of the Royal Statistical Society, Series C, Applied Statistics, 66, Part 4, 691-715.

Examples

Run this code
# NOT RUN {
pie <- c(0.002,0.2,0.4)
gamma <- matrix(c(0.99,0.007,0.003,
                  0.02,0.97,0.01,
                  0.04,0.01,0.95),byrow=TRUE, nrow=3)
mu <- matrix(c(0.3,0.7,0.2),nrow=1)
sig <- matrix(c(0.2,0.1,0.1),nrow=1)
delta <- c(1,0,0)
y <- sim.hmm0norm(mu,sig,pie,gamma,delta, nsim=5000)
# }

Run the code above in your browser using DataLab