VARmdl {MSTest}R Documentation

Vector autoregressive model

Description

This function estimates a vector autoregresive model with p lags. This can be used for the null hypothesis of a linear model against an alternative hypothesis of a Markov switching vector autoregressive model with k regimes.

Usage

VARmdl(Y, p, control = list())

Arguments

Y

a (T x q) matrix of observations.

p

integer determining the number of autoregressive lags.

control

List with model options including:

  • const: Boolean determining whether to estimate model with constant if TRUE or not if FALSE. Default is TRUE.

  • getSE: Boolean determining whether to compute standard errors of parameters if TRUE or not if FALSE. Default is TRUE.

Value

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

See Also

MSVARmdl

Examples

# ----- Bivariate VAR(1) process ----- #
set.seed(1234)
# Define DGP of VAR process
mdl_var <- list(n     = 1000, 
                p     = 1,
                q     = 2,
                mu    = c(5,-2),
                sigma = rbind(c(5.0, 1.5),
                              c(1.5, 1.0)),
                phi   = rbind(c(0.50, 0.30),
                              c(0.20, 0.70)))

# Simulate process using simuVAR() function
y_simu <- simuVAR(mdl_var)

# Set options for model estimation
control <- list(const  = TRUE, 
                getSE  = TRUE)

# Estimate model
y_var_mdl <- VARmdl(y_simu$y, p = 2, control)
summary(y_var_mdl)

[Package MSTest version 0.1.2 Index]