GofHMM1d {GaussianHMM1d} | R Documentation |
Goodness-of-fit test of a univariate Gaussian Hidden Markov Model
Description
This function performs a goodness-of-fit test of a Gaussian HMM based on a Cramér-von Mises statistic using parametric bootstrap.
Usage
GofHMM1d(y, reg, max_iter = 10000, eps = 1e-04, n_sample = 1000, n_cores)
Arguments
y |
(n x 1) data vector |
reg |
number of regimes |
max_iter |
maxmimum number of iterations of the EM algorithm; suggestion 10 000 |
eps |
eps (stopping criteria); suggestion 0.0001 |
n_sample |
number of bootstrap samples; suggestion 1000 |
n_cores |
number of cores to use in the parallel computing |
Value
pvalue |
pvalue of the Cram\'er-von Mises statistic in percent |
mu |
estimated mean for each regime |
sigma |
estimated standard deviation for each regime |
Q |
(reg x reg) estimated transition matrix |
eta |
(n x reg) conditional probabilities of being in regime k at time t given observations up to time t |
lambda |
(n x reg) probabilities of being in regime k at time t given all observations |
cvm |
Cramér-von Mises statistic for the goodness-of-fit test |
W |
Pseudo-observations that should be uniformly distributed under the null hypothesis of a Gaussian HMM |
LL |
Log-likelihood |
Author(s)
Bouchra R Nasri and Bruno N Rémillard, January 31, 2019
References
Chapter 10.2 of B. Rémillard (2013). Statistical Methods for Financial Engineering, Chapman and Hall/CRC Financial Mathematics Series, Taylor & Francis.
Examples
Q <- matrix(c(0.8, 0.3, 0.2, 0.7),2,2); mu <- c(-0.3 ,0.7) ; sigma <- c(0.15,0.05)
data <- Sim.HMM.Gaussian.1d(mu,sigma,Q,eta0=1,100)$x
gof <- GofHMM1d(data, 2, max_iter=10000, eps=0.0001, n_sample=100,n_cores=2)