VAR Models and the Granger Causality Test
Separating the directions of who tells us about whose future first.
When online searches about pet health suddenly rise, do veterinary clinic bookings also increase the following week? Conversely, after clinic visits increase, pet owners may look up more related information online. Search volume and bookings can move together over time, but whether the past of one helps predict the future of the other has to be checked separately.
Vector autoregression (VAR) is a model that puts several time series into one system and explains each variable's current value with the past values of the variables. The Granger causality test evaluates whether the past values of one variable provide additional information for predicting the future values of another. Although its name contains "causality," this test alone does not prove actual cause and effect.
In this article, we look at the structure of VAR, stationarity and lag selection, the Granger causality test, impulse response functions and forecast error variance decomposition, and forecasting and diagnostics, with a new example.
What questions does VAR answer?
An ordinary univariate time series model uses the past of one variable to predict that variable's future.
VAR, on the other hand, looks at what predictive information changes in several variables provide about each other. For example, you can explain this week's change in bookings using last week's search volume and bookings together with search volume and bookings from two weeks ago.
Each variable in a VAR is an outcome variable within the system and also an explanatory variable in the other equations. So it is better suited than a one-direction regression for examining temporal associations in both directions. However, it does not automatically control for unobserved common causes or external shocks.
Example and data setup
Suppose a regional network of veterinary clinics collected two indicators over 208 weeks (4 years).
The first is the weekly number of appointment bookings, and the second is an online search index for pet health in the same region. Bookings are assumed to be positive, and the search index is assumed to be provided on a 0–100 scale.
| Variable | Raw data | Value used in the VAR |
|---|---|---|
| Bookings (B) | Weekly bookings | Weekly change in log bookings, Δlog(B) |
| Search index (S) | Weekly search index | Weekly change in the search index, ΔS |
| Time | 208 consecutive weeks | Weeks available after preprocessing |
Using weekly changes can help reduce spurious correlation caused by long-run trends, but differencing does not always guarantee stationarity. In the analysis, you should first check each variable's time series plot, unit root tests, and whether there is seasonality. You should also keep in mind that long-run relationships can be lost in the differencing process.
Basic structure of a VAR model
A two-variable VAR(2) includes each variable's values from both 1 week and 2 weeks earlier.
Writing booking growth as y and the search index change as x gives the following.
yt = cy + a11yt−1 + a12xt−1 + a13yt−2 + a14xt−2 + uy,t
xt = cx + a21yt−1 + a22xt−1 + a23yt−2 + a24xt−2 + ux,t
The first equation explains the change in bookings, and the second explains the change in the search index. The residuals of the two equations can be correlated at the same time point. So a VAR is not simply two regression equations; it is a framework for examining the joint dynamics of the variables and the error terms.
Why check stationarity?
For estimating a stable standard VAR and for the Granger test, the stationarity condition of the time series is important.
You need to check whether the mean, variance, and autocovariance structure stay constant over time, and also whether seasonal patterns or structural changes remain.
For example, if bookings and search volume both increased over several years, their level values may show a strong correlation. But you need to distinguish whether that relationship is real predictive information or the result of a common trend. Tests such as ADF and KPSS can be used together with visual inspection.
If the two level variables are nonstationary and cointegrated, then rather than always using a differenced VAR, a VECM (vector error correction model) may be appropriate.
How many weeks back should you include? Lag selection
The p in VAR(p) determines how many time points of each variable's past values to include.
With weekly data, you could use only the previous week or include information from 2–4 weeks back. If the lag is too short, you can miss important dynamics; if it is too long, the number of parameters to estimate grows and the sample becomes insufficient.
| Candidate model | AIC | BIC | Residual autocorrelation |
|---|---|---|---|
| VAR(1) | -5.42 | -5.20 | Remains |
| VAR(2) | -5.58 | -5.15 | No clear evidence |
| VAR(3) | -5.53 | -5.03 | No clear evidence |
In this example, suppose VAR(2) was chosen by weighing AIC together with a review of the residuals. BIC prefers VAR(1), so in a real analysis it would be worth comparing the forecasting performance and residuals of both candidates. Rather than mechanically following any single criterion, you should consider the sample size and the purpose of the study.
What does the Granger causality test test?
Granger causality addresses the question: Does adding the past values of search volume improve the prediction of booking changes?
Here, improvement is usually evaluated by testing whether the relevant lag coefficients in the VAR equation are jointly 0. For example, in a VAR(2), the null hypothesis "search changes do not Granger-cause booking changes" is as follows.
H0: a12 = a14 = 0
If this hypothesis is rejected, it is interpreted as evidence that the search index changes from 1 and 2 weeks earlier contain additional information useful for predicting booking changes. The opposite direction must be tested separately. That is, to check whether booking changes Granger-cause search index changes, you jointly test the booking lag coefficients in the second equation.
How do you read Granger test results?
Suppose the VAR(2) results are as follows.
| Direction of prediction | Null hypothesis | F statistic | p-value |
|---|---|---|---|
| Search index change → booking change | Past search values add no information | 5.73 | .004 |
| Booking change → search index change | Past booking values add no information | 1.58 | .208 |
In the first test, p = .004, so the null hypothesis is rejected. So there is statistical evidence that the search index changes over the previous 1–2 weeks provide additional information for predicting booking growth. In the opposite direction, p = .208, so we did not find sufficient evidence that past booking changes further predict search index changes.
But the second result is not proof that "there is no effect." Power may be insufficient, or longer lags or other variables may be needed. Above all, the first result should not be interpreted as causal evidence that searching increases bookings. News coverage, outbreaks of infectious disease, seasonal factors, and so on could have changed both searches and bookings.
How do you interpret VAR regression coefficients?
A VAR coefficient represents the relationship between a change in a particular lagged variable and the current outcome, given the other lagged variables.
If the 1-week lag coefficient of the search index change is positive, it means last week's increase in searches is associated with this week's increase in bookings.
However, since several lags are included together, it is hard to judge the overall relationship from a single coefficient. The same variable can have a positive coefficient at a 1-week lag and a negative coefficient at a 2-week lag. To examine these dynamics as a whole, the impulse response function (IRF) is helpful.
What is an impulse response function (IRF)?
An IRF shows how the other variables respond over several later time points when an unexpected shock hits one variable.
For example, assuming a one-standard-deviation shock to the search index change, you can plot how booking growth moves 1 week later, 2 weeks later, and so on.
| Time after shock | Response of booking growth |
|---|---|
| 1 week later | +0.8 pp |
| 2 weeks later | +0.3 pp |
| 3 weeks later | +0.1 pp |
| 4 weeks later | Nearly 0 |
These values are an impulse response path set up for illustration. Also, the IRF can differ depending on how residuals that are correlated at the same time point are separated. The Cholesky decomposition used in orthogonalized IRFs is sensitive to the ordering of the variables, and generalized IRFs use different assumptions. To interpret a statistically observed impulse response as a structural causal effect, you need separate identifying restrictions or a study design.
What is forecast error variance decomposition (FEVD)?
Forecast error variance decomposition shows how much of the forecast uncertainty beyond a given horizon is associated with shocks to each variable in the system.
For example, you might estimate that 18% of the forecast error variance of booking growth 4 weeks ahead is attributed to search index shocks.
This share does not mean that 18% of all bookings occurred because of searches. It is a decomposition of the variability of forecast errors, and it depends on how shocks are identified, the ordering of the variables, and the model specification. IRF and FEVD complement the Granger test, but they do not automatically establish causality.
Does it actually help forecasting?
To check whether a VAR provides additional predictive information, you need to fit the model using only past data and then forecast the later period.
In this example, suppose the first 156 weeks are used for training and the last 52 weeks are set aside as a chronological validation period. In the subsequent sequential forecasting, only values that could actually have been known at each time point should be used.
| Model for forecasting booking change | Validation RMSE (pp) |
|---|---|
| AR model using booking changes only | 2.6 |
| VAR(2) using booking and search changes together | 2.3 |
In this comparison, the VAR reduced the validation RMSE. This suggests that search-related information may have been practically useful for that period and forecasting setup. However, whether the same advantage holds in other periods should be checked with rolling or expanding-window backtesting. Forecasting bookings under the assumption that future search index values are already known can cause information leakage.
What should you check before trusting the model?
First, you need to check the stability of the VAR.
By checking the eigenvalue conditions of the fitted system, you can see whether it is a model in which shocks grow explosively over time. You should also check residual autocorrelation with tests such as the portmanteau test to see whether the chosen lag is sufficient.
Heteroskedasticity and outliers in the residuals, common shocks, and structural changes also matter. For example, in a particular week when a pet disease was widespread, searches and bookings may spike at the same time, and a model that does not account for this event can misestimate the usual dynamics. In a real analysis, you can also consider adding the exogenous variables needed, such as weekly and annual seasonality, public holidays, and promotional campaigns.
Finally, keep in mind that as the number of VAR equations grows and the lags get longer, the number of coefficients to estimate increases. If the sample is short, you can reduce the number of variables or lags, or consider alternatives such as a regularized VAR.
How do you report VAR and Granger test results?
In reporting results, it is good to present the observation period, variable transformations, stationarity checks, the chosen lag, the Granger test results for each direction, residual and stability diagnostics, and the forecast validation method.
If you included impulse response functions, you should also state the size of the shock, how it was identified, and how the confidence intervals were calculated.
Example report
To analyze the dynamic relationship between regional veterinary clinic bookings and an online search index for pet health, 208 weeks of weekly time series were used. The log difference of bookings and the first difference of the search index were set as the analysis variables, and a VAR(2) model was applied based on information criteria and residual diagnostics.
The Granger causality tests showed that past values of the search index change provided additional predictive information about booking changes (F = 5.73, p = .004). In contrast, there was not sufficient statistical evidence that past booking changes improved the prediction of search index changes (F = 1.58, p = .208). In a comparison validated on the last 52 weeks, the RMSE of the VAR(2) was also lower than that of the univariate model (2.3 pp vs. 2.6 pp). These results suggest that the search index may be useful as a leading indicator of booking changes, but they do not prove that increased searches directly cause increased bookings.
Actual papers or reports should also include the degrees of freedom of the tests, the coefficients and confidence intervals, the estimation method, and the validation procedure.
VAR describes dynamics, and the Granger test evaluates additional predictive information
A VAR model uses the past values of several time series together to analyze the temporal associations and joint movements among the variables.
The Granger causality test evaluates whether the past values of one variable provide additional information when predicting the future values of another. So using the two methods together lets you examine direction-specific predictive relationships that are hard to see from simple correlations.
However, just because the name includes "causality," a statistical predictive relationship should not be interpreted as an actual causal relationship. Stationarity, lag selection, residual diagnostics, how shocks are identified, and chronological validation all matter.
The key is to identify which variable helps predict another variable's future, and to carefully set apart any causal claims that go beyond that scope.