<- See Stata 18's new features
Local projection estimates of impulse–response functions
Save and compare models with the irf suite
Tabulate or graph impulse responses with irf table and irf graph
With impulse–response functions, you can find out how a shock to one variable affects other variables over time. With local projections, you can estimate impulse–response functions directly using multistep regressions. Use the new lpirf command to estimate local projections, and graph or tabulate them with the irf suite.
We have quarterly data on inflation, the output gap, and the Federal funds rate.
We start by estimating the impulse–response function of a univariate model of the output gap.
. lpirf ogap Local-projection impulse–responses Sample: 1955q1 thru 2009q1 Number of obs = 217 Number of impulses = 1 Number of responses = 1 Number of controls = 1
|coefficient Std. err. z P>|z| [95% conf. interval]|
|F1.||1.292226 .0637341 20.28 0.000 1.16731 1.417143|
|F2.||1.442387 .0994943 14.50 0.000 1.247382 1.637392|
|F3.||1.401608 .1309142 10.71 0.000 1.145021 1.658195|
|F4.||1.299317 .1536651 8.46 0.000 .9981393 1.600496|
|F5.||1.118363 .1712574 6.53 0.000 .7827046 1.454021|
|F6.||.99939 .1828889 5.46 0.000 .6409344 1.357846|
|F7.||.872912 .1916226 4.56 0.000 .4973385 1.248485|
|F8.||.6999145 .1987556 3.52 0.000 .3103607 1.089468|
Each coefficient is the response to an impulse (shock) to the output gap at the specified number of periods ahead. On impact, the effect of the shock is one unit. After one period (F1.ogap), the output gap rises further to 1.29. Then peaks in the second period at 1.44. The response falls to 0.70 eight periods after a shock.
More interesting models arise when there are multiple variables, in which case we can assess the effect of a shock to one variable on another. We combine the lpirf command with the irf suite of commands to estimate, then graph, orthogonalized impulse–response functions.
. quietly lpirf inflation ogap fedfunds, lags(1/12) step(24) . irf set myirfs.irf, replace . irf create model1 . irf graph oirf, yline(0)
The first row plots the response to a federal funds rate shock; the second row plots the response to an inflation shock; and the final row plots the response to an output gap shock. An unexpected rise in interest rates leads inflation and output to both fall over the subsequent quarters, with inflation's response reaching a trough around 12 steps (3 years) after the impulse and with output's response reaching a trough around 8 steps (2 years) after the impulse. The inflation shock pushes inflation and output in opposite directions, and the interest rate rises mildly in response. The output shock leads inflation and the interest rate to both rise.
In this example, we have a monthly dataset on the logarithm of the industrial production index, the logarithm of the consumer price index, and a measure of exogenous monetary shocks from Romer and Romer (2004) and updated in Wieland and Yang (2020).
. describe Contains data from romer2004.dta Observations: 1,247 Variables: 4 3 Jan 2023 16:43
|Variable Storage Display Value|
|name type format label Variable label|
|datem float %tm|
|ln_indpro float %9.0g Log of Industrial Production|
|ln_cpi float %9.0g Log of CPI|
|money_shock double %9.0g Full-sample R&R shocks|
We are interested in the responses of industrial production and inflation to a monetary shock. We treat industrial production and inflation as endogenous and treat the monetary shock as exogenous. We fit two models: a local‐projection model and a vector autoregression (VAR) model.
. irf set comparemodels.irf, replace . quietly lpirf indpro inflation, lags(1/12) exog(L(0/12).money_shock) . irf create lpmodel . quietly var indpro inflation, lags(1/12) exog(L(0/12).money_shock) . irf create varmodel . irf graph dm, impulse(money_shock) irf(lpmodel varmodel)
The dynamic multipliers from the local‐projection and VAR models are
The top row shows the results of the local‐projection model. The bottom row shows the results of the VAR model, treating the money shock as exogenous.
Both the local‐projection and the VAR model show a slight increase in the price level after a monetary shock, peaking around 24 months after the shock and declining thereafter. Both models indicate that industrial production falls after a monetary shock, with a trough occurring around 24 months after the shock. The local-projection IRFs and VAR model IRFs provide similar results over short horizons, but begin to diverge at longer horizons. Local projections provide more flexibility in long-run responses by estimating them directly. And local projections are much faster to compute.
Romer, C. D., and D. H. Romer. 2004. A new measure of monetary shocks: Derivation and implications. American Economic Review 94: 1055–1084.
Wieland, J. F., and M. Yang. 2020. Financial dampening. Journal of Money, Credit, and Banking 52: 79–113.
Read more in the Stata Time-Series Reference Manual; see [TS] lpirf ->
View all the new features in Stata 18 ->