8000 GitHub - ckwolf92/lp_var_nberma: LPs or VARs? A Primer for Macroeconomists
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ckwolf92/lp_var_nberma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lp_var_nberma

MATLAB code for large-scale simulation studies on impulse responses using Local Projections, VARs, and several of their variants.

Reference: Montiel Olea, José Luis, Mikkel Plagborg-Møller, Eric Qian and Christian K. Wolf (2025), ''Local Projections or VARs? A Primer for Macroeconomists''

Tested in: MATLAB R2024a on MacBook Pro 2023 (M3 Pro)

IRF inference with local projections

Using our code suite, our recommended procedure for computing local projection point estimates and confidence intervals is implemented below.

Use the AIC to select the lag length p by estimating auxiliary VARs of lag length 1 through p_max.

p_max  = 20;   % Maximum lag length
method = 1;    % AIC
p      = ic_var(data_y, p_max, method);

Below returns the local projection impulse response function irs of the second variable to the first innovation.

horzs   = 0:20;  % Horizons of interest
opts_lp = {'resp_ind',  2, 'innov_ind', 1, 'estimator', 'lp',...
    'shrinkage', false,...
    'bias_corr', true,...  % Herbst and Johannsen (2024) bias correction
    'alpha',     0.05,...  % Significance level
    'se_homosk', false};   % Eicker-Huber-White standard errors};

[irs, ses, cis] = ir_estim(data_y, p, horzs, opts_lp{:});  

We recommend using the procedure of Herbst and Johannsen (2024) to bias-correct the LP estimator with heteroskedasticity-robust standard errors. Delta method standard errors and confidence intervals are stored in ses and cis respectively.

We find further finite-sample performance gains with the residual block bootstrap of Brüggemann, Jentsch, and Trenkler (2016) using the block length determined by Jentsch and Lunsford (2019).

block_length = ceil(5.03*size(data_y, 1)^(1/4));  % Jentsch and Lunsford (2019) rule of thumb
opts_lp_boot = {'bootstrap', 'var',...  % Residual bootstrap
                'boot_num', 1000,...    % Number of bootstrap draws
                'boot_blocklength', block_length};
[~, ~, ~, cis_boot] = ir_estim(data_y, p, horzs, opts_lp{:}, opts_lp_boot{:}); 

We recommend reporting percentile-t bootstrap confidence intervals, i.e., cis_boot(:,:,3).

Contents

_estim/: Impulse response estimation functions

_dfm/: Functions and scripts used for the encompassing Dynamic Factor Model (DFM) used in the simulation study

illustrations/: Illustrative figures featured in the main text

simulations/: Running and generating figures for the simulation study

  • main_dfm.m: Main file for the simulation study
  • plot_dfm_paper.m: Plots of bias, standard deviation, MSE, and confidence interval coverage across estimators and DGPs (Figures 5.1, 5.2, and 6.2 in the main text, Figures D.1-D.7 in the supplement).
  • plot_varinlpbands.m: Plot of fraction of DGPs for which the VAR point estimates are contained inside the LP confidence interval (Figure E.1 of the supplement).

Detailed replication instructions

Illustrative figures

Figures from the simulation studies

  1. Estimate IRFs from simulated data: This produces raw IRF estimates and confidence intervals for each estimator.

    • In _dfm/settings/shared.m, set settings.simul.n_mc to 1000 and settings.specifications.random_n_spec to 100.
    • Run the file simulations/main_dfm.m with the following settings:
      • Run combinations of dgp_type (set to g or mp) and mode_type (set to 3 or 5).
      • To produce the appendix results for recursive identification, run the same combinations for estimand_type='recursive'.
    • Results will be saved in the directory simulations/_results/.
  2. Generate figures: The following steps generate the figures included in the main text and supplement.

    • Run the file plot_dfm_paper.m with the following figure-specific header modifications:
      • Figures 5.1, 5.2, 6.2, and D.7: Set dgp_type_plot='both', estimand_type='obsshock', and mode_type=6.
      • Figures D.1 and D.2: Set dgp_type_plot='both', estimand_type='recursive', and mode_type=6.
      • Figures D.3 and D.4: Set dgp_type_plot='g', estimand_type='obsshock', and mode_type=6.
      • Figures D.5 and D.6: Set dgp_type_plot='mp', estimand_type='obsshock', and mode_type=6.
    • Figure E.1: Run the file plot_varinlpbands.m.

Acknowledgements

The simulation study extends that of Li, Plagborg-Møller, and Wolf (2024) with estimation routines based on the replication materials for Montiel Olea, Plagborg-Møller, Qian, and Wolf (2024).

We rely on the BVAR code of Domenico Giannone, Michele Lenza, and Giorgio Primiceri and the penalized LP code of Regis Barnichon and Christian Brownlees. We also use the Dynamic Factor Model code and data of Eben Lazarus, Daniel Lewis, Jim Stock, and Mark Watson, modified to allow for conditional heteroskedasticity of the shocks for both the factors and idiosyncratic disturbances.

Plagborg-Møller acknowledges that this material is based upon work supported by the NSF under Grant #2238049 and by the Alfred P. Sloan Foundation, and W 5715 olf does the same for NSF Grant #2314736.

About

LPs or VARs? A Primer for Macroeconomists

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0