Structural Vector Autoregressions and Local Projections via 'C++'

Estimation and identification of structural vector autoregressions and local projections, with a compiled 'C++' backend. Shocks can be identified by short-run (recursive) restrictions, long-run restrictions following Blanchard and Quah (1989) < https://www.jstor.org/stable/1827924>, maximum forecast error variance share following Uhlig (2005) , external instruments (proxy SVAR) following Mertens and Ravn (2013) and Kaenzig (2021) , heteroskedasticity across regimes, and sign or narrative sign restrictions. Local projections follow Jorda (2005) and cover instrumental variables, state-dependent and nonlinear specifications, panel data as in Mian, Sufi and Verner (2017) , and the difference-in-differences estimator of Dube, Girardi, Jorda and Taylor (2025) . Inference uses residual, wild and moving-block bootstraps, heteroskedasticity and autocorrelation consistent standard errors, and one-way or two-way cluster-robust standard errors.


tidyMacro

License  Documentation

Welcome! Full documentation and function references are available at https://tidymacro.netlify.app. For a comprehensive overview of the package's functionality and replication examples, a separate replication gallery is provided on the main webpage of the package.

Installation

# install.packages("devtools")
devtools::install_github("muhsinciftci/tidyMacro")

How tidyMacro is built and checked

tidyMacro is developed with AI coding agents, under significant human review, and every method is checked against the original studies.

Multi-agent development

The code is written mainly with Claude (Claude Code). Codex independently cross-checks the work. Each agent has a narrow role:

Agent Role
C++ engineer Implements and refactors the RcppArmadillo routines
Numerical-methods reviewer Checks the econometrics and numerics of VAR, SVAR, IV, sign restriction, bootstrap and local projection code
R interface reviewer Checks the R wrappers, plots and exported functions
Check runner Compiles the package and runs the tests and diagnostics

The reviewer and check-runner agents cannot edit the code. When the agents disagree, the code and the reference output settle it, not either model.

Human review

The author designs and reviews every function, one at a time. That covers inputs, outputs, defaults, speed and memory use. AI errors found during development are corrected by hand. Where tidyMacro deliberately differs from an original implementation, the documentation says so.

Comparison with the original studies

  • Authors' code. C++ ports are compared with the output of the original MATLAB and Stata code, such as the VAR Toolbox of Cesa-Bianchi and the authors' replication files. Stochastic methods, such as bootstraps and sign restrictions, are compared on their distributions rather than on single draws.
  • Published results. The replication gallery re-estimates published studies with tidyMacro and sets the results against the papers:
    Method Replicated study
    Short-run (recursive) restrictions Bloom (2009)
    Long-run and mixed restrictions Galí (1999); Beaudry and Portier (2014)
    External instruments (proxy SVAR) Känzig (2021)
    Noninvertible shocks Forni, Gambetti and Ricco (2022), using the Gertler and Karadi (2015) instrument
    Internal instruments; heteroskedasticity Känzig (2021)
    Sign, narrative and sign + IV restrictions Uhlig (2005); Antolín-Díaz and Rubio-Ramírez (2018); Arias, Caldara and Rubio-Ramírez (2019); Cesa-Bianchi and Sokol (2022)
    Local projections and LP-IV Jordà and Taylor (2025)
    State-dependent local projections Tenreyro and Thwaites (2016)
    Panel local projections Mian, Sufi and Verner (2017)
    LP difference-in-differences Dube, Girardi, Jordà and Taylor (2025)
  • Test suite. The testthat suite compares estimators with independent reference implementations, such as the Newey-West and cluster-robust standard errors. It also checks that results do not depend on the number of threads.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("tidyMacro")

1.1.2 by Muhsin Ciftci, 7 hours ago


https://github.com/muhsinciftci/tidyMacro


Report a bug at https://github.com/muhsinciftci/tidyMacro/issues


Browse source code at https://github.com/cran/tidyMacro


Authors: Muhsin Ciftci [aut, cre, cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports Rcpp, tibble, ggplot2, tidyr, dplyr, rlang, tidyselect

Suggests readxl, sandwich, testthat, parallel

Linking to Rcpp, RcppArmadillo


See at CRAN