Econometrics · Chapter 16

VARs and GMM

When a central bank raises interest rates, what happens to inflation, and when? Everything in the economy moves at once, so no single regression can answer. Vector autoregressions let every variable depend on the past of every other, then trace out what one surprise does over the following years. Here you’ll run a small simulated economy, hit it with shocks, and see how one quiet assumption, which variable moves first, can change the story. Then you’ll meet the generalized method of moments, the framework that unifies almost every estimator in this course, and use it to catch a bad instrument.

The economy

Cholesky ordering

Live numbers

Missions

    What you’re seeing

    The economy. Two simulated numbers move each quarter: inflation and the interest rate, each measured as a gap from its normal level. Each depends on last quarter’s values of both, plus a surprise. In the default economy the central bank raises the rate when inflation is high, and a higher rate pulls inflation down a little later.

    The VAR. Every 20 quarters, the page estimates a vector autoregression on the last 200 quarters: one regression for each variable on the lagged values of both. It never sees the true model. From the estimates it computes impulse responses: what one standard-deviation surprise in one variable does to both variables over the next 16 quarters (green, with a 90% bootstrap band). The gold dashed lines are the truth.

    Shocks. “Shock inflation” adds a surprise of two standard deviations to inflation in the next quarter. Watch the gold line jump, the blue line follow, and both fade back: the same story the impulse-response panels tell from the estimates alone.

    The ordering. The surprises in inflation and the rate are correlated, and the data can’t say which caused which within a quarter. “Inflation first” assumes the rate can react to inflation within the quarter but not the reverse. Switch it and the panels change, even though the data and the regressions are the same.

    Vector autoregressions

    In 1980, Christopher Sims argued in “Macroeconomics and Reality” that the large models economists used then rested on restrictions that were “incredible”: assumptions about which variables affect which, imposed to make the models solvable rather than because anyone believed them. His alternative was to let the data speak first. Treat every variable as depending on the recent past of every variable:

    yt = c + A₁yt−1 + … + Apyt−p + utyt is a list of variables (here inflation and the interest rate); each A is a matrix of coefficients; ut are the surprises, with covariance matrix Σ

    With the same regressors in every equation, the VAR is estimated by OLS one equation at a time. The simulation uses one lag:

    πt = a₁₁πt−1 + a₁₂it−1 + uπt,    it = a₂₁πt−1 + a₂₂it−1 + uit

    The coefficients themselves are hard to read, since effects pass back and forth between the variables. So VAR users summarize them in three ways: impulse responses, forecast-error variance decompositions (what share of the uncertainty in forecasting each variable comes from each kind of shock) and Granger-causality tests.

    From surprises to shocks: identification

    The surprises uπ and ui are correlated. If the rate surprise is partly a reaction to the inflation surprise, then “a rate surprise” mixes a policy shock with a response to inflation. To trace the effect of a pure policy shock, we write the surprises as combinations of uncorrelated structural shocks, ut = Pεt, with Var(ε) = I, so that PP′ = Σ. The impulse response at horizon h is then

    Θh = AhPcolumn k of Θh is the response of every variable, h periods later, to a one-standard-deviation shock k (for a VAR(1); with more lags the recursion is longer)

    Here is the catch. Σ has three distinct numbers (two variances and a covariance), but P has four. One more assumption is needed, and the data can’t supply it. The most common choice is a Cholesky (recursive) ordering: make P lower triangular, which assumes the first variable doesn’t respond to the second variable’s shock within the period. “Inflation first” says prices are sticky within a quarter, so inflation can’t react to a policy surprise right away, while the central bank can react to inflation at once. That is the assumption built into the simulated economy, so that ordering recovers the truth there; the other ordering doesn’t.

    Worked example: an impulse response by hand

    Take the default economy: A = [0.70 −0.15; 0.35 0.75], surprise standard deviations 0.5 (inflation) and 0.4 (rate), correlation 0.5. With inflation ordered first, the Cholesky factor is P = [0.5 0; 0.2 0.346], since 0.5 × 0.4 × 0.5 = 0.2 and 0.4√(1 − 0.25) = 0.346.

    1. Impact (h = 0) of an inflation shock: the first column of P, so inflation +0.50 and the rate +0.20.
    2. One quarter later: A × (0.50, 0.20) = (0.70 × 0.5 − 0.15 × 0.2, 0.35 × 0.5 + 0.75 × 0.2) = (0.32, 0.325).
    3. Two quarters later: A × (0.32, 0.325) = (0.175, 0.356). Inflation is fading; the rate is still rising.
    4. Three quarters later: (0.069, 0.328). The higher rate keeps pushing inflation down.

    With the rate ordered first, the inflation shock has no effect on the rate on impact by assumption, and the whole path is different.

    Try this: set the correlation to 0 and switch the ordering: nothing changes, because with uncorrelated surprises there is nothing to disentangle. Now set it to 0.7 and switch again. With rate first, an inflation shock no longer moves the rate on impact, and a rate shock appears to push inflation up at once. Same data, same VAR, different story. Researchers in practice defend their ordering with economics, or use other identifying assumptions: long-run restrictions (Blanchard and Quah, 1989), sign restrictions (Uhlig, 2005), or outside measures of policy surprises such as interest-rate moves in the minutes around central bank announcements (Gertler and Karadi, 2015).

    Granger causality, and what it doesn’t mean

    Clive Granger (1969) proposed a testable notion: x Granger-causes y if past values of x help predict y beyond what past values of y already do. In a VAR, test whether the coefficients on lagged x in the y equation are all zero, with an F test (with one lag, the square of the t statistic).

    Common mistake: “Granger causality is causality”

    It is about prediction, not cause. Christmas card sales in November predict Christmas, but they don’t cause it. In the “Rate sees the future” economy, the central bank receives news about next quarter’s inflation and moves the rate today. Past rates then predict inflation strongly (the test rejects in about 100% of samples of 200 quarters), yet in that economy the rate has no effect on inflation whatsoever. Forward-looking variables (interest rates, stock prices, survey expectations) often Granger-cause the things they anticipate. The reverse also happens: a central bank that perfectly offsets inflation can make a real effect invisible.

    Try this: choose “Rate has no effect”. The rate equation still responds to inflation, but inflation ignores the rate. The Granger test of rate → inflation should reject only about 5% of the time (4.9% in our simulations), while inflation → rate rejects every time. Then pick “Rate sees the future” and watch rate → inflation light up.

    The generalized method of moments

    The oldest estimation idea in statistics is to match moments: if the population mean is μ, estimate it by the sample mean. Karl Pearson used it in 1894. Lars Peter Hansen (1982) turned the idea into a general framework. Write what the model says as moment conditions, expectations that equal zero at the true parameter θ₀:

    E[g(wi, θ₀)] = 0  ⟶  θ̂ = argminθ ḡ(θ)′ W ḡ(θ),   ḡ(θ) = n−1Σg(wi, θ)generalized method of moments: make the sample versions of the conditions as close to zero as possible, with weights W

    If there are as many conditions as parameters, you can usually make them all exactly zero, and W doesn’t matter. If there are more (the model is overidentified), you can’t, and W decides which conditions to trust most. Almost every estimator in this course is GMM in disguise: OLS uses E[xu] = 0, instrumental variables uses E[zu] = 0, and maximum likelihood sets the average score to zero.

    Data

    Moment conditions

    Weighting

    With two conditions, x − μ and (x − μ)² − σ², the estimates are the sample mean and the sample variance (dividing by n). Add a third, (x − μ)³, which a normal distribution says should average zero (no skewness). Now there are three conditions and two parameters. For normal data the three can nearly agree; for skewed data they can’t, and the efficient weighting compromises.

    Worked example: moments by hand

    In a sample, the average of x is 3.20 and the average of x² is 11.68.

    1. First condition: x̄ − μ̂ = 0, so μ̂ = 3.20.
    2. Second: the average of (x − μ̂)² equals σ̂². Since the average of (x − μ̂)² = (average of x²) − μ̂², σ̂² = 11.68 − 3.20² = 11.68 − 10.24 = 1.44, so σ̂ = 1.2.

    Two equations, two unknowns, solved exactly. No weights needed.

    Efficient weighting and Hansen’s J

    Conditions that are noisy (whose sample averages bounce around a lot) deserve less weight. Hansen showed that the best choice is W = Ŝ−1, the inverse of the covariance matrix of the moment functions. Since Ŝ depends on θ, estimate in two steps: first with any W (such as the identity), then with Ŝ−1 computed at the first-step estimate. With efficient weights, the minimized objective has a known distribution if all the conditions are true:

    J = n · ḡ(θ̂)′ Ŝ−1 ḡ(θ̂) ~ χ²L−KHansen’s test of overidentifying restrictions: L conditions, K parameters; a large J says the conditions can’t all hold together
    Try this: choose skewed data, three moments and efficient weighting. J is large: no normal distribution can match this sample’s mean, variance and lack of symmetry at once. In our tests on samples of 200, J rejected the normal model in 97% of skewed samples and in 5.6% of normal ones. Now switch to the identity weighting: the estimate swings far from the sample mean, because the third moment is measured in cubed units and dominates an unweighted sum. That is why the weighting matters.

    Instrumental variables as GMM

    In Chapter 10, an instrument z had to be correlated with the endogenous regressor x and uncorrelated with the error u. That second requirement is a moment condition: E[z(y − βx)] = 0. With three instruments and one coefficient, there are three conditions and one unknown. Each instrument alone gives its own estimate (where its line crosses zero below); GMM combines them. 2SLS is GMM with W = (Z′Z/n)−1, which is the efficient choice only if the errors are homoskedastic.

    Worked example: reading a J test

    A study estimates one coefficient with three instruments by efficient GMM and reports J = 7.3.

    1. Degrees of freedom: L − K = 3 − 1 = 2.
    2. The 5% critical value of χ²₂ is 5.99, and 7.3 > 5.99. The p-value is about 0.026.
    3. Conclusion: the three instruments don’t agree on one value of β, so at least one is probably invalid.

    The test can’t say which one. And passing it is weak comfort: if all the instruments are invalid in the same direction, they can agree with each other and all be wrong.

    Try this: raise the third instrument’s link to the error to 0.3. Its line now crosses zero far from the others, J jumps past 5.99, and the estimate drifts away from 1. Then set it back to valid, tick heteroskedastic errors and run 500 samples. 2SLS still centers on 1, but efficient GMM, which down-weights the noisy first condition, has a smaller spread (in our tests, a standard deviation of 0.26 against 0.34).

    A short history

    Moments. Karl Pearson fitted distributions by matching moments in 1894. Ronald Fisher later showed that maximum likelihood is usually more efficient, and for decades the method of moments looked old-fashioned.

    Instruments and overidentification. Denis Sargan (1958) developed instrumental-variables estimation with more instruments than regressors and the first test of overidentifying restrictions, a forerunner of Hansen’s J.

    GMM. Hansen’s 1982 Econometrica paper gave the general theory, and Hansen and Kenneth Singleton (1982) used it to estimate how investors trade off consumption today against tomorrow directly from the conditions of an economic model, without assuming the full distribution of the data. Hansen shared the 2013 Nobel memorial prize in economics with Eugene Fama and Robert Shiller for their empirical analysis of asset prices.

    VARs. Granger’s 1969 paper introduced his causality test; Sims’s 1980 paper launched the VAR approach. Sims shared the 2011 Nobel memorial prize with Thomas Sargent for their empirical research on cause and effect in the macroeconomy. Granger shared the 2003 prize with Robert Engle (see Chapter 15).

    Where it shows up

    • Central banks. VARs with inflation, unemployment or output, and a policy interest rate are a standard tool for asking what monetary policy does and for forecasting; James Stock and Mark Watson’s 2001 survey uses exactly such a three-variable VAR.
    • Business. A company can fit a VAR to its sales, advertising spending and prices to see how a surprise ad campaign ripples through sales over the next months, and whether sales “Granger-cause” ad budgets (often they do, because budgets are set from last quarter’s sales).
    • Finance. GMM is the workhorse for testing asset-pricing models, which come as moment conditions: the expected discounted return on every asset should satisfy the same equation.
    • Policy. Dynamic panel models (for example, how this year’s investment depends on last year’s) are estimated by GMM with lagged values as instruments (the Arellano–Bond estimator).
    • Daily life. If you notice that a friend’s mood today predicts your own tomorrow, that’s Granger causality. Whether their mood causes yours, or you both react to the same news a day apart, is a separate question.

    Nothing on this page is financial or investment advice.

    Practice

    1. A VAR(1) has A = [0.5 0.2; 0 0.8] and impact matrix P = [1 0; 0.3 0.6]. What is the response of the first variable to the second shock after one period?

      Show the answer

      Θ₁ = AP. Second column of P: (0, 0.6). First row of A times it: 0.5 × 0 + 0.2 × 0.6 = 0.12.

    2. For a two-variable VAR, how many numbers does Σ contain, how many does P contain, and how many restrictions are needed?

      Show the answer

      Σ is symmetric 2 × 2: three distinct numbers. P is a general 2 × 2: four. PP′ = Σ gives three equations, so one restriction is needed; a Cholesky ordering sets one off-diagonal element of P to zero. With k variables you need k(k − 1)/2 restrictions.

    3. In a VAR with 4 lags, testing whether the stock market Granger-causes GDP gives F = 3.4 with (4, 180) degrees of freedom (5% critical value about 2.42). What do you conclude?

      Show the answer

      Reject: past stock returns help predict GDP. This does not show that stock prices cause GDP; markets look ahead and may simply anticipate news about the economy.

    4. Write the moment conditions that give the OLS estimator of y = β₀ + β₁x + u. Is the model exactly identified?

      Show the answer

      E[y − β₀ − β₁x] = 0 and E[x(y − β₀ − β₁x)] = 0. Their sample versions are the OLS normal equations. Two conditions, two parameters: exactly identified, so W doesn’t matter.

    5. A GMM model has 5 instruments and 2 parameters, and J = 4.1. Test the overidentifying restrictions at 5% (χ²₃ critical value 7.81).

      Show the answer

      Degrees of freedom 5 − 2 = 3. 4.1 < 7.81: no evidence against the instruments’ validity (p ≈ 0.25). It doesn’t prove they’re valid.

    6. Why is 2SLS not the efficient GMM estimator when errors are heteroskedastic?

      Show the answer

      2SLS uses W = (Z′Z/n)−1, which is proportional to the inverse covariance of the moments zu only when Var(u | z) is constant. With heteroskedasticity, Var(zu) = E[u²zz′] differs, and the efficient weight is its inverse. Some moments are noisier than 2SLS assumes and deserve less weight.

    7. A forecaster says: “The rate Granger-causes inflation in our VAR, so raising rates will lower inflation.” Give two reasons this could be wrong.

      Show the answer

      (1) The rate may move because the central bank anticipates inflation (forward-looking behavior), so it predicts inflation without causing it. (2) Even if there is an effect, its sign and size depend on identifying structural shocks, which Granger tests don’t do; a reduced-form coefficient mixes policy shocks with the bank’s systematic reactions. And a policy change can itself change the estimated relationships (the Lucas critique).

    How the interactive works

    The economy. Each quarter, yt = Ayt−1 + Pεt with independent standard normal shocks and P lower triangular with inflation first, so the truth satisfies the “inflation first” ordering. In the “Rate sees the future” economy, a third, unobserved news variable nt raises the rate today (0.7nt) and inflation next quarter (0.8nt), while A has no rate term in the inflation equation. A shock button adds 2 to one shock in the next quarter.

    The VAR. A VAR(1) with constants is estimated by OLS on the last 200 quarters every 20 quarters. Bands are 5th and 95th percentiles of 200 residual-bootstrap replications. The GMM labs use two-step efficient GMM with the centered covariance of the moment functions; the IV lab’s robust standard error is (G′WG)−1G′WŜWG(G′WG)−1/n.

    How it was checked (Node.js, before the page was built):

    • With 20,000 quarters, the estimated A was [0.707 −0.150; 0.346 0.751] against the true [0.70 −0.15; 0.35 0.75]. Both Cholesky orderings reproduce Σ̂ exactly; impulse responses match direct matrix powers (0.175250 at h = 2); variance shares add to 1.
    • Granger tests over 1,000 samples of 200 quarters: rate → inflation rejected 4.9% of the time when the true coefficient is 0, and 100% in the “sees the future” economy.
    • With a correlation of 0.6, the impact of a rate shock on inflation was 0.000 (inflation first, the truth) vs 0.300 (rate first). The 90% bootstrap bands covered the true response of the rate to an inflation shock 89% / 84% / 77% of the time at horizons 0 / 2 / 6 (bootstrap bands for persistent VARs tend to be too narrow in samples this size).
    • Method of moments: with two conditions, GMM returns the sample mean and variance to six decimals with J = 0. With three, J rejected 5.6% of normal samples and 97% of skewed ones (n = 200).
    • IV: the GMM code’s 2SLS equals the shared library’s two-stage least squares (0.983371). Over 1,000 samples, J rejected 4.9% with valid instruments (4.7% with heteroskedasticity), 58% and 99.6% with the third instrument’s link at 0.15 and 0.3. With heteroskedasticity, the SD of 2SLS was 0.344 and of efficient GMM 0.260; robust 95% intervals covered 95.0% and 93.6%.

    Check yourself

    1. Why does a Cholesky ordering matter for impulse responses?

      Show the answer

      The VAR coefficients and forecasts are the same under any ordering. The ordering only changes how correlated surprises are split into structural shocks, which changes the impulse responses.

    2. Past interest rates help predict inflation in a VAR. What can you conclude?

      Show the answer

      Granger causality is predictive. Forward-looking policy can make the rate predict inflation without any causal effect.

    3. With 4 moment conditions and 4 parameters, what is Hansen’s J statistic?

      Show the answer

      With as many conditions as parameters, the sample conditions can usually be set exactly to zero, so there is nothing left to test.

    4. What weighting matrix makes GMM efficient?

      Show the answer

      W = S−1 gives noisier conditions less weight. 2SLS’s (Z′Z/n)−1 is proportional to it only with homoskedastic errors.

    5. For a VAR(1), the impulse response at horizon h to structural shocks is…

      Show the answer

      A structural shock enters as Pε; each period it passes through A once more, so after h periods the response is AhP.

    Sources

    • J. D. Hamilton, Time Series Analysis (Princeton, 1994), chapters 11 (vector autoregressions, impulse responses, variance decompositions, Granger causality) and 14 (generalized method of moments).
    • J. H. Stock and M. W. Watson, Vector autoregressions, Journal of Economic Perspectives 15(4), 101–115 (2001).
    • L. Kilian and H. Lütkepohl, Structural Vector Autoregressive Analysis (Cambridge University Press, 2017).
    • J. M. Wooldridge, Econometric Analysis of Cross Section and Panel Data, 2nd ed. (MIT Press, 2010), chapters 8 and 14 (system instrumental variables and generalized method of moments).
    • C. A. Sims, Macroeconomics and reality, Econometrica 48(1), 1–48 (1980). C. W. J. Granger, Investigating causal relations by econometric models and cross-spectral methods, Econometrica 37(3), 424–438 (1969).
    • L. P. Hansen, Large sample properties of generalized method of moments estimators, Econometrica 50(4), 1029–1054 (1982). L. P. Hansen and K. J. Singleton, Generalized instrumental variables estimation of nonlinear rational expectations models, Econometrica 50(5), 1269–1286 (1982).
    • O. J. Blanchard and D. Quah, The dynamic effects of aggregate demand and supply disturbances, American Economic Review 79(4), 655–673 (1989). H. Uhlig, What are the effects of monetary policy on output?, Journal of Monetary Economics 52(2), 381–419 (2005). M. Gertler and P. Karadi, Monetary policy surprises, credit costs, and economic activity, American Economic Journal: Macroeconomics 7(1), 44–76 (2015).
    • The Nobel Prize: economic sciences 2011 (Sargent and Sims) and 2013 (Fama, Hansen and Shiller).
    • Wikipedia (secondary): Vector autoregression, Granger causality, Generalized method of moments, Lars Peter Hansen.
    Saved on this device only.
    @teddyrookbook GitHub