HMMextra0s-package {HMMextra0s}R Documentation

Hidden Markov Models with Extra Zeros Hidden Markov Models (HMMs) with Extra Zeros

Description

The DESCRIPTION file:

Package: HMMextra0s
Type: Package
Title: Hidden Markov Models with Extra Zeros
Version: 1.1.0
Imports: mvtnorm, ellipse
Suggests: HiddenMarkov
Depends: methods
Date: 2021-08-02
Author: Ting Wang, Wolfgang Hayek, and Alexander Pletzer
Maintainer: Ting Wang <ting.wang@otago.ac.nz>
Description: Contains functions for hidden Markov models with observations having extra zeros as defined in the following two publications, Wang, T., Zhuang, J., Obara, K. and Tsuruoka, H. (2016) <doi:10.1111/rssc.12194>; Wang, T., Zhuang, J., Buckby, J., Obara, K. and Tsuruoka, H. (2018) <doi:10.1029/2017JB015360>. The observed response variable is either univariate or bivariate Gaussian conditioning on presence of events, and extra zeros mean that the response variable takes on the value zero if nothing is happening. Hence the response is modelled as a mixture distribution of a Bernoulli variable and a continuous variable. That is, if the Bernoulli variable takes on the value 1, then the response variable is Gaussian, and if the Bernoulli variable takes on the value 0, then the response is zero too. This package includes functions for simulation, parameter estimation, goodness-of-fit, the Viterbi algorithm, and plotting the classified 2-D data. Some of the functions in the package are based on those of the R package 'HiddenMarkov' by David Harte. This updated version has included an example dataset and R code examples to show how to transform the data into the objects needed in the main functions. We have also made changes to increase the speed of some of the functions.
LazyData: no
ZipData: no
License: GPL(>=2)
URL: https://www.stats.otago.ac.nz/?people=ting_wang
Packaged: 2021-08-02 01:56:30 UTC; twang
NeedsCompilation: yes

Index of help topics:

HMMextra0s-package      Hidden Markov Models with Extra Zeros Hidden
                        Markov Models (HMMs) with Extra Zeros
Kii                     Tremor data in the Kii region in 2002 and 2003
                        for use in function hmm0norm2d
Viterbi.hmm0norm        Viterbi Path of a 1-D HMM with Extra Zeros
Viterbi.hmm0norm2d      Viterbi Path of a Bivariate HMM with Extra
                        Zeros
cumdist.hmm0norm        Cumulative distribution of an HMM with Extra
                        Zeros
hmm0norm                Parameter Estimation of an HMM with Extra Zeros
hmm0norm2d              Parameter Estimation of a bivariate HMM with
                        Extra Zeros
plotVitloc2d            Plot the Classified 2-D Data of a Bivariate HMM
                        With Extra Zeros
plotVitpath2d           Plot the Viterbi Path of a Bivariate HMM With
                        Extra Zeros
sim.hmm0norm            Simulation of a 1-D HMM with Extra Zeros
sim.hmm0norm2d          Simulation of a Bivariate HMM with Extra Zeros

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.

Details

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 mm states, where mm can be estimated from the data. Let St{1,,m}S_t \in \{1,\cdots,m\} denote the state of the Markov chain at time tt. The probability of a first-order Markov chain in state jj at time tt given the previous states is P(St=jSt1,,S1)=P(St=jSt1)P(S_t=j|S_{t-1},\cdots,S_{1})=P(S_t=j|S_{t-1}). These states are not observable. The observation YtY_t at time tt depends on the state StS_t of the Markov chain.

In this framework, we are interested in estimating the transition probability matrix Γ=(γij)m×m\Gamma=(\gamma_{ij})_{m\times m} of the Markov chain that describes the migration pattern and the density function f(ytSt=i)f(y_t|S_t=i) that gives the distribution feature of observations in state ii, where γij=P(St=jSt1=i)\gamma_{ij}=P(S_t=j|S_{t-1}=i).

Let ZtZ_t be a Bernoulli variable, with Zt=1Z_t=1 if an event is present at tt, and Zt=0Z_t=0, otherwise. Let Xt\mathbf{X}_t be the response variable (e.g., location of the tremor cluster in 2D space) at time tt. We set P(Zt=0St=i)=1piP(Z_t=0|S_t=i)=1-p_i and P(Zt=1St=i)=piP(Z_t=1|S_t=i)=p_i. We assume that, given Zt=1Z_t=1 and St=iS_t=i, Xt\mathbf{X}_t follows a univariate or bivariate normal distribution, e.g. for a bivariate normal,

f(xtZt=1,St=i)=12πΣi1/2exp(12(xtμi)TΣi1(xtμi)). 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 ZtZ_t and Xt\mathbf{X}_t conditional on the system being in state ii at time tt is

f(xt,ztSt=i)=(1pi)1zt[pi12πΣi1/2exp(12(xtμi)TΣi1(xtμi))]zt, 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 pip_i, μi=E(XtSt=i,Zt=1)\bm{\mu}_i=E(\mathbf{X}_t|S_t=i,Z_t=1) and Σi=Var(XtSt=i,Zt=1)\bm{\Sigma}_i=Var(\mathbf{X}_t|S_t=i,Z_t=1) are parameters to be estimated.

Author(s)

Ting Wang, Wolfgang Hayek, and Alexander Pletzer

Maintainer: Ting Wang <ting.wang@otago.ac.nz>

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.

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, doi: 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


[Package HMMextra0s version 1.1.0 Index]