GofHMMGen: Goodness-of-fit of univariate hidden Markov model

View source: R/GofHMMGen.R

GofHMMGenR Documentation

Goodness-of-fit of univariate hidden Markov model

Description

This function performs a goodness-of-fit test for a univariate hidden Markov model

Usage

GofHMMGen(
  y,
  ZI = 0,
  reg,
  family,
  start = 0,
  max_iter = 10000,
  eps = 1e-04,
  size = 0,
  n_samples = 1000,
  n_cores = 1
)

Arguments

y

observations

ZI

1 if zero-inflated, 0 otherwise (default)

reg

number of regimes

family

distribution name; run the function distributions() for help

start

starting parameter for the estimation

max_iter

maximum number of iterations of the EM algorithm; suggestion 10000

eps

precision (stopping criteria); suggestion 0.0001.

size

additional parameter for some discrete distributions; run the command distributions() for help

n_samples

number of bootstrap samples; suggestion 1000

n_cores

number of cores to use in the parallel computing

Value

pvalue

pvalue of the Cramer-von Mises statistic in percent

theta

Estimated parameters; (r x p)

Q

estimated transition matrix; ; (r x r)

eta

(conditional probabilities of being in regime k at time t given observations up to time t; (n x r)

lambda

conditional probabilities of being in regime k at time t given all observations; (n x r)

U

pseudo-observations that should be uniformly distributed under the null hypothesis

cvm

Cramer-von-Mises statistic for goodness-of-fit

W

matrix of Rosenblatt transforms; (n x r)

LL

log-likelihood

nu

stationary distribution

AIC

Akaike information criterion

BIC

bayesian information criterion

CAIC

consistent Akaike information criterion

AICcorrected

Akaike information criterion corrected

HQC

Hannan-Quinn information criterion

stats

Empirical means and standard deviation of each regimes using lambda

pred_l

Estimated regime using lambda

pred_e

Estimated regime using eta

runs_l

Estimated number of runs using lambda

runs_e

Estimated number of runs using eta

Examples

family = "gaussian"
Q = matrix(c(0.8, 0.3, 0.2, 0.7), 2, 2) ; theta = matrix(c(0, 1.7, 0, 1),2,2) ;
y = SimHMMGen(theta, size=0, Q, ZI=1, family,  100)$SimData
out=GofHMMGen(y,1,2,family,n_samples=10)



GenHMM1d documentation built on Sept. 9, 2025, 5:50 p.m.

Related to GofHMMGen in GenHMM1d...