Learn R Programming

MSGARCH (version 2.51)

State: State probabilities.

Description

Method returning the filtered, predictive, and smoothed probabilities of the states, and the most probable path computed with the Viterbi algorithm.

Usage

State(object, ...)

# S3 method for MSGARCH_SPEC State(object, par, data, ...)

# S3 method for MSGARCH_ML_FIT State(object, newdata = NULL, ...)

# S3 method for MSGARCH_MCMC_FIT State(object, newdata = NULL, ...)

Value

A list of class MSGARCH_PSTATE with the following elements:

  • FiltProb: Filtered probabilities (array of size (T + T*) x (nmcmc or 1) x K).

  • PredProb: Predictive probabilities (array of size (T + T* + 1) x (nmcmc or 1) x K).

  • SmoothProb: Smoothed probabilities (array of size (T + T* + 1) x (nmcmc or 1) x K).

  • Viterbi: Most likely path (matrix of size (T + T*) x (nmcmc or 1)).

The class MSGARCH_PSTATE contains the plot method. The plot method contains as input type.prob which is one of "filtered", "predictive", "smoothed", "viterbi". (Default: type.prob = "smoothed")

Arguments

object

Model specification of class MSGARCH_SPEC created with CreateSpec or fit object of type MSGARCH_ML_FIT created with FitML or MSGARCH_MCMC_FIT created with FitMCMC.

...

Not used. Other arguments to State.

par

Vector (of size d) or matrix (of size nmcmc x d) of parameter estimates where d must have the same length as the default parameters of the specification.

data

Vector (of size T) of observations.

newdata

Vector (of size T*) of new observations. (Default newdata = NULL)

Details

If a matrix of parameter estimates is given, each parameter estimate (each row) is evaluated individually.

Examples

Run this code
# create specification
spec <- CreateSpec()

# load data
data("SMI", package = "MSGARCH")

# state from specification
par <- c(0.1, 0.1, 0.8, 0.2, 0.1, 0.8, 0.99, 0.01)
state <- State(object = spec, par = par, data = SMI)
plot(state, type.prob = "filtered")

# state from ML fit
fit <- FitML(spec = spec, data = SMI)
state <- State(object = fit)
plot(state, type.prob = "smoothed")

if (FALSE) {
# state from MCMC fit
set.seed(1234)
fit <- FitMCMC(spec = spec, data = SMI)
state <- State(object = fit)
plot(state, type.prob = "smoothed")
}

Run the code above in your browser using DataLab