Learn R Programming

GaussianHMM1d (version 1.1.2)

EstRegime: Estimated Regimes for the univariate Gaussian HMM

Description

This function computes and plots the most likely regime for univariate Gaussian HMM using probabilities of being in regime k at time t given all observations (lambda) and probabilities of being in regime k at time t given observations up to time t (eta).

Usage

EstRegime(t, y, lambda, eta)

Value

A

Estimated Regime using lambda

B

Estimated Regime using eta

runsA

Estimated number of runs using lambda

runsB

Estimated number of runs using eta

pA

Graph for the estimated regime for each observation using lambda

pB

Graph for the estimated regime for each observation using eta

Arguments

t

(nx1) vector of dates (years, ...); if no dates then t=[1:length(y)]

y

(nx1) vector of data;

lambda

(nxreg) probabilities of being in regime k at time t given all observations;

eta

(nxreg) probabilities of being in regime k at time t given observations up to time t;

Author

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

Run this code
 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
t=c(1:100);
est <- EstHMM1d(data, 2)
EstRegime(t,data,est$lambda, est$eta)

Run the code above in your browser using DataLab