MacroEconometricModels.jl

Read full text
Authors: Wookyung Chung
Cited by: 0

Abstract

A comprehensive Julia package for macroeconomic time series analysis. Provides VAR, VECM, Bayesian VAR, Panel VAR, Local Projections, Factor Models, ARIMA, time series filters, GMM, ARCH/GARCH/Stochastic Volatility estimation, nowcasting (DFM, BVAR, bridge equations with news decomposition), structural identification (including non-Gaussian and heteroskedasticity-based methods), hypothesis testing, typed data containers, publication-quality output with multi-format bibliographic references, and interactive D3.js visualization. Installation using Pkg Pkg.add("MacroEconometricModels") Features Univariate Models Time Series Filters - Trend-cycle decomposition: Hodrick-Prescott filter Hamilton (2018) regression filter Beveridge-Nelson decomposition (ARIMA psi-weights) Baxter-King band-pass filter Boosted HP filter (Phillips & Shi 2021) with ADF/BIC/fixed stopping ARIMA - AR, MA, ARMA, ARIMA estimation via CSS, exact MLE (Kalman filter), or CSS-MLE Automatic order selection via auto_arima with grid search over (p,d,q), AIC/BIC information criteria Multi-step ahead forecasting with confidence intervals via psi-weight accumulation Volatility Models: ARCH - Engle (1982) ARCH(q) with MLE, ARCH-LM test, Ljung-Box squared residuals GARCH - GARCH(p,q), EGARCH (Nelson 1991), GJR-GARCH (Glosten, Jagannathan & Runkle 1993) Stochastic Volatility - Bayesian SV via Kim-Shephard-Chib Gibbs sampler (basic, leverage, Student-t variants) Multi-step volatility forecasts with simulation CIs Diagnostics: news impact curves, persistence, half-life, unconditional variance Multivariate Models Vector Autoregression (VAR) - OLS estimation with lag order selection (AIC, BIC, HQ) Bayesian VAR (BVAR) - Minnesota priors with hyperparameter optimization (Giannone, Lenza & Primiceri 2015) Vector Error Correction Model (VECM) - Johansen MLE and Engle-Granger two-step estimation Automatic cointegrating rank selection (trace/max-eigenvalue) VAR conversion (to_var) enabling all 18+ identification methods VECM-specific forecasting preserving cointegrating relationships Granger causality: short-run, long-run, and strong tests Local Projections (LP) - Jorda (2005) with extensions: HAC standard errors (Newey-West, White, Driscoll-Kraay) Instrumental Variables (Stock & Watson 2018) Smooth IRF via B-splines (Barnichon & Brownlees 2019) State-dependent LP (Auerbach & Gorodnichenko 2013) Propensity Score Matching (Angrist et al. 2018) Structural LP with multi-shock IRFs (Plagborg-Møller & Wolf 2021) Direct multi-step forecasting with analytical/bootstrap CIs Factor Models Static factors via PCA with Bai-Ng information criteria (IC1, IC2, IC3) Dynamic Factor Models (two-step and EM estimation) Generalized Dynamic Factor Models (spectral methods, Forni et al. 2000) Unified forecasting with theoretical (analytical) and bootstrap confidence intervals for all three factor model types Panel Models Panel VAR (PVAR) - GMM estimation for dynamic panel data: First-difference GMM (Arellano & Bond 1991) and System GMM (Blundell & Bond 1998) Forward orthogonal deviations (Helmert transform) as alternative to first-differencing Fixed-Effects OLS within estimator Windmeijer (2005) finite-sample corrected standard errors for two-step GMM Specification tests: Hansen J-test, Andrews-Lu (2001) MMSC for lag/moment selection Structural analysis: OIRF, GIRF (Pesaran & Shin 1998), FEVD, stability Group-level block bootstrap confidence intervals for IRFs Instrument management: min/max lag truncation, collapse, PCA reduction GMM Generalized Method of Moments - One-step, two-step, and iterated; Hansen J-test Linear GMM - Closed-form solver for panel IV estimation Sandwich covariance - Robust GMM variance with Windmeijer correction Structural Identification Traditional: Cholesky (recursive), sign restrictions (Rubio-Ramirez et al. 2010), narrative restrictions (Antolin-Diaz & Rubio-Ramirez 2018), long-run (Blanchard & Quah 1989), zero+sign (Arias et al. 2018), penalty function (Mountford & Uhlig 2009) Heteroskedasticity-based: Markov-switching, GARCH, smooth-transition, external volatility (Rigobon 2003, Lewis 2021) Non-Gaussian ICA: FastICA, JADE, SOBI, distance covariance, HSIC (Hyvärinen et al. 2010) Non-Gaussian ML: Student-t, mixture-normal, pseudo-ML, skew-normal (Lanne et al. 2017) Innovation Accounting Impulse Response Functions (IRF) - Bootstrap, theoretical, and Bayesian credible intervals Forecast Error Variance Decomposition (FEVD) - Frequentist and Bayesian LP-FEVD - R², LP-A, LP-B estimators with bootstrap CIs (Gorodnichenko & Lee 2019) Historical Decomposition (HD) - Decompose observed movements into structural shock contributions Summary Tables - Publication-quality output with report(), table(), print_table() Display Backends - Switch between text, LaTeX, and HTML table output with set_display_backend() Bibliographic References - refs(model) outputs AEA-style citations in text, LaTeX, BibTeX, or HTML Nowcasting Dynamic Factor Model (DFM) - EM algorithm with Kalman smoother for mixed-frequency data (Banbura & Modugno 2014) Arbitrary missing patterns and ragged edges Mariano-Murasawa [1 2 3 2 1] temporal aggregation for quarterly variables Block factor structure, AR(1)/IID idiosyncratic components Large Bayesian VAR - GLP-style Normal-Inverse-Wishart prior (Cimadomo et al. 2022) Hyperparameter optimization via marginal log-likelihood maximization Minnesota shrinkage with sum-of-coefficients and co-persistence priors Bridge Equations - OLS regressions combining pairs of monthly indicators via median (Banbura et al. 2023) News Decomposition - Attribute nowcast revisions to individual data releases Panel Balancing - balance_panel() fills NaN in TimeSeriesData/PanelData using DFM imputation Statistical Identification via Higher Moments Heteroskedasticity-based - Markov-switching (Lanne & Lütkepohl 2008), GARCH (Normandin & Phaneuf 2004), smooth-transition (Lütkepohl & Netšunajev 2017), external volatility (Rigobon 2003) Non-Gaussian ICA - FastICA, JADE, SOBI, distance covariance, HSIC (Hyvärinen et al. 2010, Matteson & Tsay 2017) Non-Gaussian ML - Student-t, mixture-normal, pseudo-ML, skew-normal (Lanne et al. 2017, Gourieroux et al. 2017) Multivariate normality tests - Jarque-Bera, Mardia, Doornik-Hansen, Henze-Zirkler Identifiability diagnostics - Shock gaussianity, independence, identification strength, LR tests Seamless integration: irf(model, 20; method=:fastica) works out of the box See Lewis (2025) for a comprehensive review Hypothesis Tests Unit Root Tests - ADF, KPSS, Phillips-Perron, Zivot-Andrews, Ng-Perron Cointegration - Johansen test (trace and max-eigenvalue) VAR - Granger causality (pairwise and block Wald tests), stationarity diagnostics Panel VAR - Hansen J-test for overidentifying restrictions, Andrews-Lu MMSC for lag/moment selection Model Comparison - Likelihood ratio (LR) and Lagrange multiplier (LM/score) tests for nested models Stationarity diagnostics - unit_root_summary(), test_all_variables() Visualization Interactive D3.js plots - plot_result() renders self-contained HTML with inline D3.js v7 (no additional dependencies) 31 dispatch methods covering IRF, FEVD, historical decomposition, filters, forecasts, volatility models, factor models, data containers, and nowcasting Three chart types: line (with confidence bands), stacked area, and bar charts Interactive tooltips, responsive layout, multi-panel grid figures save_plot(p, "file.html") saves to disk; display_plot(p) opens in browser; auto-renders in Jupyter Common kwargs: var, shock, title, save_path, ncols Data Management Typed containers - TimeSeriesData, PanelData, CrossSectionData with variable names, frequency, transformation codes, and descriptions Built-in datasets - FRED-MD (126 monthly variables), FRED-QD (245 quarterly variables), and Penn World Table (38 OECD countries, 1950–2023 balanced panel) Data diagnostics - diagnose() scans for NaN/Inf/constant columns; fix() cleans via listwise deletion, interpolation, or mean imputation FRED transformations - apply_tcode() / inverse_tcode() for all 7 FRED transformation codes Filtering - apply_filter() applies HP, Hamilton, BN, BK, or boosted HP per-variable to TimeSeriesData and PanelData Panel support - xtset() for Stata-style panel construction; balanced/unbalanced detection Summary statistics - describe_data() with per-variable N, mean, std, quantiles, skewness, kurtosis Seamless estimation - All estimation functions accept TimeSeriesData directly

Fields of Study & Subjects

Monetary Policy and Economic Impact Financial Risk and Volatility Modeling Data Analysis with R

Publication details

Journal / source
Zenodo (CERN European Organization for Nuclear Research)
Publication date
31 January 2026
Language
EN