hmm0norm: Parameter Estimation of an HMM with Extra Zeros

Description Usage Arguments Value Author(s) References Examples

View source: R/hmm0norm.R

Description

Calculates the parameter estimates of a 1-D HMM with observations having extra zeros.

Usage

1
hmm0norm(R, Z, pie, gamma, mu, sig, delta, tol=1e-6, print.level=1, fortran = TRUE)

Arguments

R

is the observed data. R is a T * 1 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.

pie

is a vector of length m, the jth 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 jth element of which is the mean of the (Gaussian) distribution of the observations in state j.

sig

is a 1 * m matrix, the jth 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.

tol

is the tolerance for testing convergence of the iterative estimation process. The default tolerance is 1e-6. For initial test of model fit to your data, a larger tolerance (e.g., 1e-3) should be used to save time.

print.level

controls the amount of output being printed. Default is 1. If print.level=1, only the log likelihoods and the differences between the log likelihoods at each step of the iterative estimation process, and the final estimates are printed. If print.level=2, the log likelihoods, the differences between the log likelihoods, and the estimates at each step of the iterative estimation process are printed.

fortran

is logical, and determines whether Fortran code is used; default is TRUE.

Value

pie

is the estimated probability of Z=1 when the process is in each state.

mu

is the estimated mean of the (Gaussian) distribution of the observations in each state.

sig

is the estimated standard deviation of the (Gaussian) distribution of the observations in each state.

gamma

is the estimated transition probability matrix of the hidden Markov chain.

delta

is the estimated initial distribution vector of the Markov chain.

LL

is the log likelihood.

Author(s)

Ting Wang

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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)
R <- as.matrix(y$x,ncol=1)
Z <- y$z
yn <- hmm0norm(R, Z, pie, gamma, mu, sig, delta)
yn

HMMextra0s documentation built on Aug. 3, 2021, 9:06 a.m.