10.3 VAR diagnostics
Diagnostic checking in VAR models commonly refers to checking model stability and residuals checking
VAR model stability ensures that responses to shocks do not explode over time
VAR model is stable if all eigenvalues of the companion matrix lie inside the unit circle, i.e. each absoulte eigenvalue must be less than \(1\)
The eigenvalues of the companion matrix \(A_1\) are obtained by solving the characteristic equation
\[\begin{equation} det(A_1-\lambda I_n)=0 \tag{10.7} \end{equation}\]
If VAR model is not stable it implies that time-series used in VAR are not stationary or too many lags are included
VAR stability can be achieved by reducing the number of lags and/or transforming non-stationary time-series into stationary by differencing
Residuals checking includes:
- the multivariate Breusch-Godfrey test for autocorrelation of the error terms
- the multivariate ARCH test for conditional heteroscedacticity of the error terms
- the multivariate Jarque-Bera test for error terms normality
- If the null hypotheses of all three tests (BG, ARCH and JB) are not rejected, it can be concluded that estimated VAR model is adequate as it satisfies the underlying assumptions (normality, no autocorrelation and no conditional heteroscedasity)
vars
that supports the commands for multivariate time-series analysis such as VAR, and load it from the library. Combine time-series data of the growth
and production
in a new time-series object z
. Assuming that both variables are endogenous, determine the optimal time lag of the vector autoregression model VAR (\(p\)) by using VARselect()
command. Estimate the appropriate VAR(\(p\)) model and present the results in a single table by modelsummary()
command. Perform all diagnostics by applying the commands: roots()
, serial.test()
, arch.test()
and normality.test()
. Finally, obtain Granger causality test in both directions by causality()
command, and plot two orthogonal impulse response functions (OIRF). Comment the obtained results.
Solution
Copy the code lines below to the clipboard and paste them into an R Script file opened in RStudio. In this example, AIC and FPE suggest \(2\) lags as appropriate, while SC (BIC) and HQC suggest \(1\) time lag. We continue the VAR analysis with \(2\) lags when preferring a model that better fits the data, even at the cost of its complexity (if you prefer a more parsimonious model with fewer parameters, you may choose lag \(1\)). The final decision will depend on model’s interpretability, stability and diagnostic checking. Estimated VAR(\(2\)) model includes \(10\) parameters and \(3\) elements of covariance matrix
\[z_t=a_0+A_1 z_{t-1}+A_2 z_{t-2}+u_t~;~~~~~~~~u_t\sim WN(0,~~\Sigma)\]
\[\underbrace{\begin{bmatrix}growth_t \\ produc_t \end{bmatrix}}_{z_t}=\underbrace{\begin{bmatrix} -8.161 \\ 45.381\end{bmatrix}}_{a_0}+ \underbrace{\begin{bmatrix} 0.894 \quad 0.219 \\ 1.010 \quad 0.659 \end{bmatrix}}_{A_1} \underbrace{\begin{bmatrix}growth_{t-1} \\ produc_{t-1}\end{bmatrix}}_{z_{t-1}}\] \[~~~~~~~~~~~~~~~~~~~~~+\underbrace{\begin{bmatrix} -0.106 \quad -0.129 \\ -0.587 \quad-0.097 \end{bmatrix}}_{A_2} \underbrace{\begin{bmatrix}growth_{t-2} \\ produc_{t-2} \end{bmatrix}}_{z_{t-2}}+\underbrace{\begin{bmatrix} \widehat{u}_{1,t} \\ \widehat{u}_{2,t} \end{bmatrix}}_{\widehat{u}_t}\] \[\widehat{\Sigma}=\begin{bmatrix} 0.612 \quad 0. 408 \\ 0.408 \quad 3.938 \end{bmatrix}\] Total \(6\) out of \(10\) parameters are statistically significant at \(5\%\) significance level. Model VAR(\(2\)) is stable and residuals exhibit no autocorrelation or hoteroscedasticity problem, although they do not pass normality test. Granger tests indicate causality in both directions, while OIRF’s decay slowly.install.packages("vars") # installing "vars" package
library(vars) # loading the same package
# Prior to appropriate lag selection, variables should be combined into one object
=cbind(indicators[,1],indicators[,2]) # combining two time-series into one object "z"
zcolnames(z)=c("growth","production") # naming the columns
VARselect(z,type="const",lag.max=4) # appropriate lag selection according to information criteria
=VAR(z,p=2,type="const") # estimating VAR(2) model
var2summary(var2) # printing the results of estimated VAR(2) model
library(modelsummary) # loading "modelsummary" package
modelsummary(list("growth"=var2[["varresult"]][["growth"]],"production"=var2[["varresult"]][["production"]]), stars=TRUE,fmt=4)
roots(var2) # checking VAR stability
serial.test(var2,type="BG") # checking autocorrelation of the residuals
arch.test(var2) # checking conditional heteroscedsticity of the residuals
normality.test(var2) # checking residuals normality
causality(var2,cause="production") # Granger causality (does production cause growth)
causality(var2,cause="growth") # Granger causality (does growth cause production)
# Plotting two OIRFs
plot(irf(var2,response="growth",impulse="production",ortho=TRUE,boot=TRUE))
plot(irf(var2,response="production",impulse="growth",ortho=TRUE,boot=TRUE))