State {MSGARCH} | R Documentation |
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 class 'MSGARCH_SPEC'
State(object, par, data, ...)
## S3 method for class 'MSGARCH_ML_FIT'
State(object, newdata = NULL, ...)
## S3 method for class 'MSGARCH_MCMC_FIT'
State(object, newdata = NULL, ...)
Arguments
object |
Model specification of class |
... |
Not used. Other arguments to |
par |
Vector (of size d) or matrix (of size |
data |
Vector (of size T) of observations. |
newdata |
Vector (of size T*) of new observations. (Default |
Details
If a matrix of parameter estimates is given, each parameter estimate (each row) is evaluated individually.
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"
)
Examples
# 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")
## Not run:
# state from MCMC fit
set.seed(1234)
fit <- FitMCMC(spec = spec, data = SMI)
state <- State(object = fit)
plot(state, type.prob = "smoothed")
## End(Not run)