Learn R Programming

MSGARCH (version 0.17.7)

transmat: Transition Matrix.

Description

Method returning the transition matrix.

Usage

transmat(object, theta, n)

Arguments

object
Model specification of class MSGARCH_SPEC created with create.spec or fit object of type MSGARCH_MLE_FIT created with fit.mle.
theta
Vector (of size d) of parameter estimates (not require when using a fit object).
n
Number of steps ahead. (Default: n = 1

Value

A matrix (of size K x K) in the case of a Markov-Switching model or a vector (of size K) in the case of a Mixture model. The columns indcates the starting states while the rows indicates the transition states.

Examples

Run this code
# load data
data("sp500")
sp500 = sp500[1:1000]

# create model specification
spec = MSGARCH::create.spec() 

# fit the model on the data with ML estimation using DEoptim intialization
set.seed(123)
fit = MSGARCH::fit.mle(spec = spec, y = sp500, ctr = list(do.init = FALSE))

# Extract the transition matrix 10 steps ahead
transmat.mle = MSGARCH::transmat(fit, n = 10)

print(transmat.mle)

Run the code above in your browser using DataLab