MSVARmdl {MSTest}R Documentation

Markov-switching vector autoregressive model

Description

This function estimates a Markov-switching vector autoregressive model

Usage

MSVARmdl(Y, p, k, control = list())

Arguments

Y

(T x q) vector with observational data.

p

integer for the number of lags to use in estimation. Must be greater than or equal to 0.

k

integer for the number of regimes to use in estimation. Must be greater than or equal to 2.

control

List with optimization options including:

  • getSE: Boolean. If TRUE standard errors are computed and returned. If FALSE standard errors are not computed. Default is TRUE.

  • msmu: Boolean. If TRUE model is estimated with switch in mean. If FALSE model is estimated with constant mean. Default is TRUE.

  • msvar: Boolean. If TRUE model is estimated with switch in variance. If FALSE model is estimated with constant variance. Default is TRUE.

  • init_theta: vector of initial values. vector must contain (1 x q) vector mu, vech(sigma), and vec(P) where sigma is a (q x q) covariance matrix. This is optional. Default is NULL, in which case initVals_MSARmdl is used to generate initial values.

  • method: string determining which method to use. Options are 'EM' for EM algorithm or 'MLE' for Maximum Likelihood Estimation.

  • maxit: integer determining the maximum number of EM iterations.

  • thtol: double determining the convergence criterion for the absolute difference in parameter estimates theta between iterations. Default is 1e-6.

  • maxit_converge: integer determining the maximum number of initial values attempted until solution is finite. For example, if parameters in theta or logLike are NaN another set of initial values (up to maxit_converge) is attempted until finite values are returned. This does not occur frequently for most types of data but may be useful in some cases. Once finite values are obtained, this counts as one iteration towards use_diff_init. Default is 500.

  • use_diff_init: integer determining how many different initial values to try (that do not return NaN; see maxit_converge). Default is 1.

  • mle_stationary_constraint: Boolean determining if only stationary solutions are considered (if TRUE) or not (if FALSE). Default is TRUE.

  • mle_variance_constraint: double used to determine the lower bound on the smallest eigenvalue for the covariance matrix of each regime. Default is 1e-3.

  • mle_theta_low: Vector with lower bounds on parameters (Used only if method = "MLE"). Default is NULL.

  • mle_theta_upp: Vector with upper bounds on parameters (Used only if method = "MLE"). Default is NULL.

Value

List of class MSVARmdl (S3 object) with model attributes including:

List with model characteristics

References

Dempster, A. P., N. M. Laird, and D. B. Rubin. 1977. “Maximum Likelihood from Incomplete Data via the EM Algorithm.” Journal of the Royal Statistical Society. Series B 39 (1): 1–38..

Krolzig, Hans-Martin. 1997. “The markov-switching vector autoregressive model.”. Springer.

See Also

VARmdl

Examples

set.seed(123)
# Define DGP of MS VAR process
mdl_msvar2 <- list(n     = 200, 
                   p     = 1,
                   q     = 2,
                   mu    = rbind(c(5, -2),
                                 c(10, 2)),
                   sigma = list(rbind(c(5.0, 1.5),
                                      c(1.5, 1.0)),
                                rbind(c(7.0, 3.0),
                                      c(3.0, 2.0))),
                   phi   = rbind(c(0.50, 0.30),
                                 c(0.20, 0.70)),
                   k     = 2,
                   P     = rbind(c(0.90, 0.10),
                                 c(0.10, 0.90)))

# Simulate process using simuMSVAR() function
y_msvar_simu <- simuMSVAR(mdl_msvar2)

# Set options for model estimation
control <- list(msmu   = TRUE, 
                msvar  = TRUE,
                method = "EM",
                use_diff_init = 1)
                
# Estimate model

  y_msvar_mdl <- MSVARmdl(y_msvar_simu$y, p = 2, k = 2, control)
  summary(y_msvar_mdl)


[Package MSTest version 0.1.2 Index]