| 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 |
p |
integer determining the number of autoregressive lags. |
control |
List with model options including:
|
Value
List of class VARmdl (S3 object) with model attributes including:
y: a
(T-p x q)matrix of observations.X: a
(T-p x p*q + const)matrix of lagged observations with a leading column of1s ifconst=TRUEor not ifconst=FALSE.x: a
(T-p x p*q)matrix of lagged observations.fitted: a
(T-p x q)matrix of fitted values.resid: a
(T-p x q)matrix of residuals.inter: a
(1 x q)vector of estimated intercepts of each process.mu: a
(1 x q)vector of estimated means of each process.coef: coefficient estimates. First row are the intercept (i.e., not
mu) ifconst=TRUE. This is the same ast(phi)ifconst=FALSE.intercept: estimate of intercepts.
phi: a
(q x p*q)matrix of estimated autoregressive coefficients.Fmat: Companion matrix containing autoregressive coefficients.
stdev: a
(q x 1)vector of estimated standard deviation of each process.sigma: a
(q x q)estimated covariance matrix.theta: vector containing:
mu,vech(sigma), andvec(t(phi)).theta_mu_ind: vector indicating location of mean with
1and0otherwise.theta_sig_ind: vector indicating location of variance and covariances with
1and0otherwise.theta_var_ind: vector indicating location of variances with
1and0otherwise.theta_phi_ind: vector indicating location of autoregressive coefficients with
1and0otherwise.stationary: Boolean indicating if process is stationary if
TRUEor non-stationary ifFALSE.n: number of observations after lag transformation (i.e.,
n = T-p).p: number of autoregressive lags.
q: number of series.
k: number of regimes. This is always
1inVARmdl.Fmat: matrix from companion form. Used to determine is process is stationary.
control: List with model options used.
logLike: log-likelihood.
AIC: Akaike information criterion.
BIC: Bayesian (Schwarz) information criterion.
Hess: Hessian matrix. Approximated using
hessianand only returned ifgetSE=TRUE.info_mat: Information matrix. Computed as the inverse of
-Hess. If matrix is not PD then nearest PD matrix is obtained usingnearest_spd. Only returned ifgetSE=TRUE.nearPD_used: Boolean determining whether
nearPDfunction was used oninfo_matifTRUEor not ifFALSE. Only returned ifgetSE=TRUE.theta_se: standard errors of parameters in
theta. Only returned ifgetSE=TRUE.
See Also
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)