Home  /  Products  /  StataNow  /  Panel-data vector autoregressive model

<- See more new Stata features

Highlights

  • Vector autoregressive models for panel data

    • Include exogenous, endogenous, and predetermined regressors

    • Control how instruments are used

  • Interpret results via impulse–response functions

  • Perform Granger causality tests

  • Obtain moment- and model-selection criteria

  • Perform stability tests

With the new xtvar command, you can now fit a panel-data vector autoregressive (VAR) model to analyze the trajectories of related variables when you observe multiple units or panels over time. This command is part of StataNow™.

VAR models have long been a staple of multivariate time-series analysis, but these models require relatively long series. Now you can apply the same tools to panel data, using observations across panels to compensate for the shorter span typical of these data. You can evaluate the model using moment- and model-selection criteria and Granger causality tests. And you can interpret results using impulse–response functions (IRFs).

Let's see it work

We have data first analyzed by Dahlberg and Johansson (2000) on expenditures, revenues, and government grants for 265 municipalities in Sweden. We want to see how they alter their spending and taxing behavior in response to grants from the central government. We have nine years of annual data for each municipality. Nine observations would be insufficient to fit a time-series VAR model, but because we have observations for a panel of different municipalities, we can perform a panel-data VAR analysis.

Let's load the data and fit a model. We specify the lags(2) option in the xtvar command to include two lags of each dependent variable in each equation:

. webuse swedishgov.dta
(1979-1987 Swedish municipality data)

. xtvar grants revenues expenditures, lags(2)

Panel-data vector autoregression                      Number of obs    = 1,590
Group variable: idcode                                Number of groups =   265
Time variable: year                                   Obs per group:
                                                                   min =     6
Number of moment conditions = 243                                  avg =   6.0
                                                                   max =     6
Fixed-effects transform: FOD
Two-step results
                                (Std. err. adjusted for 265 clusters in idcode)
WC robust
Coefficient std. err. z P>|z| [95% conf. interval]
grants
grants
L1. .1540956 .0589697 2.61 0.009 .0385171 .2696742
L2. .0639641 .0535182 1.20 0.232 -.0409297 .1688579
revenues
L1. -.0305405 .0161976 -1.89 0.059 -.0622872 .0012062
L2. -.0252658 .0146918 -1.72 0.085 -.0540612 .0035295
expenditures
L1. .0142411 .0169733 0.84 0.401 -.019026 .0475082
L2. .0186601 .014656 1.27 0.203 -.0100651 .0473853
revenues
grants
L1. -3.558775 .6062701 -5.87 0.000 -4.747043 -2.370508
L2. -1.663785 .2048423 -8.12 0.000 -2.065268 -1.262301
revenues
L1. -.0657256 .0972598 -0.68 0.499 -.2563513 .1249001
L2. -.2419489 .0769968 -3.14 0.002 -.3928599 -.0910379
expenditures
L1. .2548482 .0997368 2.56 0.011 .0593676 .4503288
L2. .0240828 .0805262 0.30 0.765 -.1337456 .1819111
expenditures
grants
L1. -3.040373 .5854329 -5.19 0.000 -4.1878 -1.892945
L2. -1.526928 .1814479 -8.42 0.000 -1.88256 -1.171297
revenues
L1. -.1236013 .0851185 -1.45 0.146 -.2904304 .0432279
L2. -.2586326 .0759257 -3.41 0.001 -.4074441 -.109821
expenditures
L1. .2620421 .0866905 3.02 0.003 .0921319 .4319523
L2. -.0219875 .0767859 -0.29 0.775 -.1724852 .1285101
Hansen's test of overid. restrictions: chi2(225) = 261.92  Prob > chi2 = 0.046 GMM-type instruments: L(2/.).(grants revenues expenditures)

Interpreting the raw coefficients from a panel-data VAR model is not terribly illuminating, but xtvar's postestimation commands make obtaining insights easy. We first perform a Granger causality test to see whether grants Granger-cause expenditures. Granger causality is a rather weak notion of causality; it simply asks whether lagged values of one variable are useful in predicting another variable. To do this, we can use the same vargranger command that works after fitting time-series VAR models:

. vargranger

Granger causality Wald tests
Equation Excluded chi2 df Prob > chi2
grants revenues 4.1875 2 0.123
grants expenditures 1.9027 2 0.386
grants ALL 9.6314 4 0.047
revenues grants 66.326 2 0.000
revenues expenditures 7.4854 2 0.024
revenues ALL 85.573 4 0.000
expenditures grants 71.603 2 0.000
expenditures revenues 11.762 2 0.003
expenditures ALL 77.2 4 0.000

Looking at the equation for expenditures, we see that grants do Granger-cause expenditures. The \(\chi^2\) statistic is 71.6 on 2 degrees of freedom, which provides evidence to reject the null hypothesis of no Granger causality. In other words, if we were to forecast expenditures, we would obtain a lower mean-square prediction error if we included lags of grants in addition to lags of expenditures and lags of revenues.

We can also use the irf suite of commands to obtain IRFs after fitting a panel-data VAR model. We first use irf create to compute IRFs based on the results of our model. We then use the irf graph command to graph the IRFs and evaluate how a shock to each variable is expected to affect the trajectories of each variable in the next eight time periods.

. irf create baseline, set(swedish_govt_irfs)
(file swedish_govt_irfs.irf created)
(file swedish_govt_irfs.irf now active)
(file swedish_govt_irfs.irf updated)

. irf graph irf, byopt(yrescale)

Looking at the plot in the first column of the second row, we see our simple IRF indicates that an unanticipated grant to a municipality leads to lower expenditures in the two years after the grant is received but then returns to the initial spending level.

xtvar also has postestimation tools that allow us to explore the robustness of our findings; these tools are similar to those you would use after fitting a VAR model. For instance, we could investigate the choice of lag length and instruments used to identify the parameters and find an alternative specification using xtvarsoc. And you can check for stability using varstable.

Reference

Dahlberg, M., and E. Johansson. 2000. An examination of the dynamic behavior of local governments using GMM bootstrapping methods. Journal of Applied Econometrics 15: 401–416

Made for data science.

Get started today.