Learn R Programming

MSGARCH (version 1.3)

State: State probabilities.

Description

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

Usage

State(object, ...)

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

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

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

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 n.mcmc 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.

new.data

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

Value

A list of class MSGARCH_PSTATE with the following elements:

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

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

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

  • Viterbi: Most likely path (matrix of size (T + T*) x (n.mcmc 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")

Details

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

Examples

Run this code
# NOT RUN {
# load data
data("SMI", package = "MSGARCH")

# create model specification
# MS(2)-GARCH(1,1)-Normal (default)
spec <- CreateSpec()

# fit the model on the data with ML estimation
fit <- FitML(spec = spec, data = SMI)

# compute the filtered state probabilities
state <- State(object = fit)
plot(state, type.prob = "smoothed")
plot(state, type.prob = "predictive")
plot(state, type.prob = "filtered")
plot(state, type.prob = "viterbi")
# }

Run the code above in your browser using DataLab