![]() |
VOOZH | about |
Vector Autoregression (VAR) is a statistical tool used to investigate the dynamic relationships between multiple time series variables. Unlike univariate autoregressive models, which only forecast a single variable based on its previous values, VAR models investigate the interconnectivity of many variables. They accomplish this by modeling each variable as a function of not only its previous values but also of the past values of other variables in the system. In this article, we are going to explore the fundamentals of Vector Autoregression.
Table of Content
Vector Autoregression was first presented in the 1960s by economist Clive Granger. Granger's significant discoveries laid the framework for understanding and modeling the dynamic interactions that exist among economic factors. VAR models acquired significant momentum in econometrics and macroeconomics during the 1970s and 1980s.
Vector Autoregression (VAR) is a multivariate extension of autoregression (AR) models. While traditional AR models analyze the relationship between a single variable and its lagged values, VAR models consider multiple variables simultaneously. In a VAR model, each variable is regressed on its own lagged values as well as lagged values of other variables in the system.
VAR models are mathematically represented as a system of simultaneous equations, where each equation describes the behavior of one variable as a function of its own lagged values and the lagged values of all other variables in the system.
Mathematically, a VAR(p) model with 'p' lags can be represented as:
Here,
To ensure the validity and trustworthiness of the results from VAR analysis, various assumptions and requirements must be met.
VAR analysis is subject to several assumptions and requirements to ensure the validity and reliability of the results:
The code conducts Vector Autoregression (VAR) analysis on randomly generated time series data, including stationarity testing, VAR modeling, forecasting, and visualization of the forecasted outcomes.
Output:
Checking for stationarity in time series data is crucial for VAR (Vector Autoregression) modeling because VAR assumes that the time series variables are stationary. Stationarity implies that the statistical properties of the time series remain constant over time, such as mean, variance, and autocorrelation.
This part defines a function var_analysis(data) that conducts Vector Autoregression (VAR) analysis on the given dataset. It consists of four steps: checking stationarity and visualizing the original data, applying the VAR model, forecasting future values, and visualizing the forecast. Finally, it calls the var_analysis() function with the provided data to execute the analysis.
In the third step, the code forecasts future values using the VAR model. It first determines the lag order of the model (lag_order) and then uses this information to generate forecasts for the next 10 steps (steps=10) and in fourth step, the forecasted values are visualized. A new set of date indices (forecast_index) starting from '2024-04-11' for the next 10 periods is created.
Output:
Step 1: Checking stationarity and visualizing the original data
Stationarity test for A
ADF Statistic: -8.43759993424834
p-value: 1.7990274249398063e-13
Critical Values:
1%: -3.498
5%: -2.891
10%: -2.583
Stationarity test for B
ADF Statistic: -11.229664527662438
p-value: 1.9214648218450937e-20
Critical Values:
1%: -3.498
5%: -2.891
10%: -2.583
Stationarity test for C
ADF Statistic: -9.028783852793346
p-value: 5.516998045646418e-15
Critical Values:
1%: -3.498
5%: -2.891
10%: -2.583
Step 2: Applying VAR model
Step 3: Forecasting
Step 4: Visualizing forecastThe results of the Augmented Dickey-Fuller (ADF) test for each variable in the dataset.
All three variables (A, B, and C) in the dataset are stationary based on the results of the Augmented Dickey-Fuller test.