The DESCRIPTION file:
HMMextra0s
HMMextra0s
This package contains functions to estimate the parameters of the HMMs with extra zeros using hmm0norm (1-D HMM)
and hmm0norm2d (2-D HMM), to calculate the cumulative distribution of the 1-D HMM using cumdist.hmm0norm,
to estimate the Viterbi path using Viterbi.hmm0norm (1-D HMM) and Viterbi.hmm0norm2d (2-D HMM), to
simulate this class of models using sim.hmm0norm (1-D HMM) and sim.hmm0norm2d (2-D HMM), to plot the
classified 2-D data with different colours representing different hidden states using plotVitloc2d, and to plot the
Viterbi path using plotVitloc2d.
This package is used to estimate the parameters, carry out simulations, and estimate the Viterbi path for 1-D and 2-D HMMs with extra zeros as defined in the two publications in the reference (also briefly defined below). It contains examples using simulated data for how to set up initial values for a data analysis and how to plot the results.
An HMM is a statistical model in which the observed process is dependent on an unobserved Markov chain. A Markov chain is a sequence of states which exhibits a short-memory property such that the current state of the chain is dependent only on the previous state in the case of a first-order Markov chain. Assume that the Markov chain has \(m\) states, where \(m\) can be estimated from the data. Let \(S_t \in \{1,\cdots,m\}\) denote the state of the Markov chain at time \(t\). The probability of a first-order Markov chain in state \(j\) at time \(t\) given the previous states is \(P(S_t=j|S_{t-1},\cdots,S_{1})=P(S_t=j|S_{t-1})\). These states are not observable. The observation \(Y_t\) at time \(t\) depends on the state \(S_t\) of the Markov chain.
In this framework, we are interested in estimating the transition probability matrix \(\Gamma=(\gamma_{ij})_{m\times m}\) of the Markov chain that describes the migration pattern and the density function \(f(y_t|S_t=i)\) that gives the distribution feature of observations in state \(i\), where \(\gamma_{ij}=P(S_t=j|S_{t-1}=i)\).
Let \(Z_t\) be a Bernoulli variable, with \(Z_t=1\) if an event is present at \(t\), and \(Z_t=0\), otherwise. Let \(\mathbf{X}_t\) be the response variable (e.g., location of the tremor cluster in 2D space) at time \(t\). We set \(P(Z_t=0|S_t=i)=1-p_i\) and \(P(Z_t=1|S_t=i)=p_i\). We assume that, given \(Z_t=1\) and \(S_t=i\), \(\mathbf{X}_t\) follows a univariate or bivariate normal distribution, e.g. for a bivariate normal, $$ f(\mathbf{x}_t|Z_t=1, S_t=i)=\frac{1}{2\pi |\bm{\Sigma}_i|^{1/2}}\exp\left(-\frac{1}{2} (\mathbf{x}_t-\bm{\mu}_i)^T\bm{\Sigma}_i^{-1}(\mathbf{x}_t-\bm{\mu}_i)\right). $$ The joint probability density function of \(Z_t\) and \(\mathbf{X}_t\) conditional on the system being in state \(i\) at time \(t\) is $$ f(\mathbf{x}_t,z_t | S_t=i)=(1-p_i)^{1-z_t}\left[p_i\frac{1}{2\pi |\bm{\Sigma}_i|^{1/2}}\exp\left(-\frac{1}{2}(\mathbf{x}_t-\bm{\mu}_i)^T\bm{\Sigma}_i^{-1}(\mathbf{x}_t-\bm{\mu}_i)\right)\right]^{z_t}, $$ where \(p_i\), \(\bm{\mu}_i=E(\mathbf{X}_t|S_t=i,Z_t=1)\) and \(\bm{\Sigma}_i=Var(\mathbf{X}_t|S_t=i,Z_t=1)\) are parameters to be estimated.
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.
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.
Some of the functions in the package are based on those of the R package ``HiddenMarkov":
Harte, D. (2021) HiddenMarkov: Hidden Markov Models. R package version 1.8-13. URL: https://cran.r-project.org/package=HiddenMarkov