Learn R Programming

HMMextra0s (version 1.1.0)

Viterbi.hmm0norm2d: Viterbi Path of a Bivariate HMM with Extra Zeros

Description

Finds the most probable sequence of hidden states of an observed process of a bivariate HMM with extra zeros.

Usage

Viterbi.hmm0norm2d(R, Z, HMMest)

Arguments

R

is the observed data. R is a \(T * 2\) matrix, where \(T\) is the number of observations.

Z

is the binary data with the value 1 indicating that an event was observed and 0 otherwise. Z is a vector of length \(T\).

HMMest

is a list which contains pie, gamma, sig, mu, and delta (the bivariate HMM parameter estimates).

Value

y

is the estimated Viterbi path.

v

is the estimated probability of each time point being in each state.

References

Wang, T., Zhuang, J., Buckby, J., Obara, K. and Tsuruoka, H. (2018) Identifying the recurrence patterns of non-volcanic tremors using a 2D hidden Markov model with extra zeros. Journal of Geophysical Research, 10.1029/2017JB015360.

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(35.03,137.01,
               35.01,137.29,
               35.15,137.39),byrow=TRUE,nrow=3)
sig <- array(NA,dim=c(2,2,3))
sig[,,1] <- matrix(c(0.005, -0.001,
                   -0.001,0.01),byrow=TRUE,nrow=2)
sig[,,2] <- matrix(c(0.0007,-0.0002,
                    -0.0002,0.0006),byrow=TRUE,nrow=2)
sig[,,3] <- matrix(c(0.002,0.0018,
                     0.0018,0.003),byrow=TRUE,nrow=2)
delta <- c(1,0,0)
y <- sim.hmm0norm2d(mu,sig,pie,gamma,delta, nsim=5000)
R <- y$x
Z <- y$z
HMMEST <- hmm0norm2d(R, Z, pie, gamma, mu, sig, delta)
Viterbi3 <- Viterbi.hmm0norm2d(R,Z,HMMEST)
# }

Run the code above in your browser using DataLab