API Types

This page documents all core types in MacroEconometricModels.jl.

Module

MacroEconometricModels.MacroEconometricModelsModule
MacroEconometricModels

A Julia package for macroeconomic time series analysis, providing tools for:

  • Vector Autoregression (VAR) estimation
  • Bayesian VAR (BVAR) with Minnesota priors
  • Structural identification (Cholesky, sign restrictions, narrative, long-run)
  • Impulse Response Functions (IRF)
  • Forecast Error Variance Decomposition (FEVD)
  • Factor models via Principal Component Analysis
  • Local Projections (LP) with various extensions:
    • HAC standard errors (Jordà 2005)
    • 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)
  • ARIMA/ARMA model estimation, forecasting, and order selection
  • Generalized Method of Moments (GMM) estimation

Quick Start

using MacroEconometricModels

# Estimate a VAR model
Y = randn(100, 3)
model = estimate_var(Y, 2)

# Compute IRFs with bootstrap confidence intervals
irf_result = irf(model, 20; ci_type=:bootstrap)

# Local Projection IRFs with HAC standard errors
lp_result = estimate_lp(Y, 1, 20; cov_type=:newey_west)
lp_irf_result = lp_irf(lp_result)

# Bayesian estimation
post = estimate_bvar(Y, 2; prior=:minnesota)

References

  • Bańbura, M., Giannone, D., & Reichlin, L. (2010). Large Bayesian vector auto regressions.
  • Lütkepohl, H. (2005). New Introduction to Multiple Time Series Analysis.
  • Rubio-Ramírez, J. F., Waggoner, D. F., & Zha, T. (2010). Structural vector autoregressions.
  • Jordà, Ò. (2005). Estimation and Inference of Impulse Responses by Local Projections.
  • Stock, J. H., & Watson, M. W. (2018). Identification and Estimation of Dynamic Causal Effects.
  • Barnichon, R., & Brownlees, C. (2019). Impulse Response Estimation by Smooth Local Projections.
  • Auerbach, A. J., & Gorodnichenko, Y. (2013). Fiscal Multipliers in Recession and Expansion.
  • Angrist, J. D., Jordà, Ò., & Kuersteiner, G. M. (2018). Semiparametric Estimates of Monetary Policy Effects.
source

Data Containers

MacroEconometricModels.TimeSeriesDataType
TimeSeriesData{T<:AbstractFloat} <: AbstractMacroData

Container for time series data with metadata.

Fields

  • data::Matrix{T} — Tobs × nvars data matrix
  • varnames::Vector{String} — variable names
  • frequency::Frequency — data frequency
  • tcode::Vector{Int} — FRED transformation codes per variable (default: all 1 = levels)
  • time_index::Vector{Int} — integer time identifiers (default: 1:T)
  • T_obs::Int — number of observations
  • n_vars::Int — number of variables
  • desc::Vector{String} — dataset description (length-1 vector for mutability)
  • vardesc::Dict{String,String} — per-variable descriptions keyed by variable name
  • source_refs::Vector{Symbol} — reference keys for bibliographic citations (see refs())
  • dates::Vector{String} — date labels (default: empty; use set_dates! to populate)

Constructors

TimeSeriesData(data::Matrix; varnames, frequency=Other, tcode, time_index, desc, vardesc, source_refs, dates)
TimeSeriesData(data::Vector; varname="x1", frequency=Other, desc, vardesc, source_refs, dates)
TimeSeriesData(df::DataFrame; frequency=Other, varnames, desc, vardesc, source_refs, dates)
source
MacroEconometricModels.PanelDataType
PanelData{T<:AbstractFloat} <: AbstractMacroData

Container for panel (longitudinal) data with group and time identifiers.

Fields

  • data::Matrix{T} — stacked data matrix (sum of obs across groups × n_vars)
  • varnames::Vector{String} — variable names
  • frequency::Frequency — data frequency
  • tcode::Vector{Int} — FRED transformation codes per variable
  • group_id::Vector{Int} — group identifier per row
  • time_id::Vector{Int} — time identifier per row
  • cohort_id::Union{Vector{Int}, Nothing} — treatment cohort per row (nothing if unused)
  • group_names::Vector{String} — unique group labels
  • n_groups::Int — number of groups
  • n_vars::Int — number of variables
  • T_obs::Int — total number of rows
  • balanced::Bool — true if all groups have same number of observations
  • desc::Vector{String} — dataset description (length-1 vector for mutability)
  • vardesc::Dict{String,String} — per-variable descriptions keyed by variable name
  • source_refs::Vector{Symbol} — reference keys for bibliographic citations (see refs())
source
MacroEconometricModels.CrossSectionDataType
CrossSectionData{T<:AbstractFloat} <: AbstractMacroData

Container for cross-sectional data (single time point, multiple observations).

Fields

  • data::Matrix{T} — Nobs × nvars data matrix
  • varnames::Vector{String} — variable names
  • obs_id::Vector{Int} — observation identifiers
  • N_obs::Int — number of observations
  • n_vars::Int — number of variables
  • desc::Vector{String} — dataset description (length-1 vector for mutability)
  • vardesc::Dict{String,String} — per-variable descriptions keyed by variable name
  • source_refs::Vector{Symbol} — reference keys for bibliographic citations (see refs())
source
MacroEconometricModels.DataDiagnosticType
DataDiagnostic

Result of diagnose(d) — per-variable issue counts and overall cleanliness.

Fields

  • n_nan::Vector{Int} — NaN count per variable
  • n_inf::Vector{Int} — Inf count per variable
  • is_constant::Vector{Bool} — true if variable has zero variance
  • is_short::Bool — true if series has fewer than 10 observations
  • varnames::Vector{String} — variable names
  • is_clean::Bool — true if no issues detected
source
MacroEconometricModels.DataSummaryType
DataSummary

Result of describe_data(d) — per-variable summary statistics.

Fields

  • varnames::Vector{String} — variable names
  • n::Vector{Int} — non-NaN observation count per variable
  • mean::Vector{Float64} — mean of finite values
  • std::Vector{Float64} — standard deviation
  • min::Vector{Float64} — minimum
  • p25::Vector{Float64} — 25th percentile
  • median::Vector{Float64} — median (50th percentile)
  • p75::Vector{Float64} — 75th percentile
  • max::Vector{Float64} — maximum
  • skewness::Vector{Float64} — skewness
  • kurtosis::Vector{Float64} — excess kurtosis
  • T_obs::Int — total observations
  • n_vars::Int — number of variables
  • frequency::Frequency — data frequency
source

Time Series Filters

MacroEconometricModels.HPFilterResultType
HPFilterResult{T} <: AbstractFilterResult

Result of the Hodrick-Prescott filter (Hodrick & Prescott 1997).

Fields

  • trend::Vector{T}: Estimated trend component (length T_obs)
  • cycle::Vector{T}: Cyclical component y - trend (length T_obs)
  • lambda::T: Smoothing parameter used
  • T_obs::Int: Number of observations
source
MacroEconometricModels.HamiltonFilterResultType
HamiltonFilterResult{T} <: AbstractFilterResult

Result of the Hamilton (2018) regression filter.

Regresses $y_{t+h}$ on $[1, y_t, y_{t-1}, \ldots, y_{t-p+1}]$. Residuals are the cyclical component; fitted values are the trend.

Fields

  • trend::Vector{T}: Fitted values (length T_obs - h - p + 1)
  • cycle::Vector{T}: Residuals (length T_obs - h - p + 1)
  • beta::Vector{T}: OLS coefficients [intercept; lag coefficients]
  • h::Int: Forecast horizon
  • p::Int: Number of lags
  • T_obs::Int: Original series length
  • valid_range::UnitRange{Int}: Indices into original series where results are valid
source
MacroEconometricModels.BeveridgeNelsonResultType
BeveridgeNelsonResult{T} <: AbstractFilterResult

Result of the Beveridge-Nelson (1981) trend-cycle decomposition.

Decomposes a unit-root process into a permanent (random walk + drift) component and a transitory (stationary) component using the ARIMA representation.

Fields

  • permanent::Vector{T}: Permanent (trend) component
  • transitory::Vector{T}: Transitory (cycle) component
  • drift::T: Estimated drift (mean of first differences)
  • long_run_multiplier::T: Long-run multiplier psi(1) = 1 + sum(psi weights)
  • arima_order::Tuple{Int,Int,Int}: (p, d, q) order used
  • T_obs::Int: Number of observations
source
MacroEconometricModels.BaxterKingResultType
BaxterKingResult{T} <: AbstractFilterResult

Result of the Baxter-King (1999) band-pass filter.

Isolates cyclical fluctuations in a specified frequency band while removing both low-frequency trend and high-frequency noise.

Fields

  • cycle::Vector{T}: Band-pass filtered component (length T_obs - 2K)
  • trend::Vector{T}: Residual trend y - cycle (length T_obs - 2K)
  • weights::Vector{T}: Symmetric filter weights [a0, a1, ..., a_K]
  • pl::Int: Lower period bound (e.g., 6 quarters)
  • pu::Int: Upper period bound (e.g., 32 quarters)
  • K::Int: Truncation length (observations lost at each end)
  • T_obs::Int: Original series length
  • valid_range::UnitRange{Int}: Indices into original series where results are valid
source
MacroEconometricModels.BoostedHPResultType
BoostedHPResult{T} <: AbstractFilterResult

Result of the boosted HP filter (Phillips & Shi 2021).

Iteratively re-applies the HP filter to the cyclical component until a stopping criterion is met, improving trend estimation by removing remaining unit root behavior.

Fields

  • trend::Vector{T}: Final trend estimate (length T_obs)
  • cycle::Vector{T}: Final cyclical component (length T_obs)
  • lambda::T: Smoothing parameter used
  • iterations::Int: Number of boosting iterations performed
  • stopping::Symbol: Stopping criterion used (:ADF, :BIC, or :fixed)
  • bic_path::Vector{T}: BIC value at each iteration
  • adf_pvalues::Vector{T}: ADF p-values at each iteration
  • T_obs::Int: Number of observations
source

ARIMA Models

MacroEconometricModels.ARModelType
ARModel{T} <: AbstractARIMAModel

Autoregressive AR(p) model: yₜ = c + φ₁yₜ₋₁ + ... + φₚyₜ₋ₚ + εₜ

Fields

  • y::Vector{T}: Original data
  • p::Int: AR order
  • c::T: Intercept
  • phi::Vector{T}: AR coefficients [φ₁, ..., φₚ]
  • sigma2::T: Innovation variance
  • residuals::Vector{T}: Estimated residuals
  • fitted::Vector{T}: Fitted values
  • loglik::T: Log-likelihood
  • aic::T: Akaike Information Criterion
  • bic::T: Bayesian Information Criterion
  • method::Symbol: Estimation method (:ols, :mle)
  • converged::Bool: Whether optimization converged
  • iterations::Int: Number of iterations (0 for OLS)
source
MacroEconometricModels.MAModelType
MAModel{T} <: AbstractARIMAModel

Moving average MA(q) model: yₜ = c + εₜ + θ₁εₜ₋₁ + ... + θqεₜ₋q

Fields

  • y::Vector{T}: Original data
  • q::Int: MA order
  • c::T: Intercept
  • theta::Vector{T}: MA coefficients [θ₁, ..., θq]
  • sigma2::T: Innovation variance
  • residuals::Vector{T}: Estimated residuals
  • fitted::Vector{T}: Fitted values
  • loglik::T: Log-likelihood
  • aic::T: Akaike Information Criterion
  • bic::T: Bayesian Information Criterion
  • method::Symbol: Estimation method (:css, :mle, :css_mle)
  • converged::Bool: Whether optimization converged
  • iterations::Int: Number of iterations
source
MacroEconometricModels.ARMAModelType
ARMAModel{T} <: AbstractARIMAModel

Autoregressive moving average ARMA(p,q) model: yₜ = c + φ₁yₜ₋₁ + ... + φₚyₜ₋ₚ + εₜ + θ₁εₜ₋₁ + ... + θqεₜ₋q

Fields

  • y::Vector{T}: Original data
  • p::Int: AR order
  • q::Int: MA order
  • c::T: Intercept
  • phi::Vector{T}: AR coefficients [φ₁, ..., φₚ]
  • theta::Vector{T}: MA coefficients [θ₁, ..., θq]
  • sigma2::T: Innovation variance
  • residuals::Vector{T}: Estimated residuals
  • fitted::Vector{T}: Fitted values
  • loglik::T: Log-likelihood
  • aic::T: Akaike Information Criterion
  • bic::T: Bayesian Information Criterion
  • method::Symbol: Estimation method (:css, :mle, :css_mle)
  • converged::Bool: Whether optimization converged
  • iterations::Int: Number of iterations
source
MacroEconometricModels.ARIMAModelType
ARIMAModel{T} <: AbstractARIMAModel

Autoregressive integrated moving average ARIMA(p,d,q) model. The model is fit to the d-times differenced series as ARMA(p,q).

Fields

  • y::Vector{T}: Original (undifferenced) data
  • y_diff::Vector{T}: Differenced series
  • p::Int: AR order
  • d::Int: Integration order (number of differences)
  • q::Int: MA order
  • c::T: Intercept (on differenced series)
  • phi::Vector{T}: AR coefficients
  • theta::Vector{T}: MA coefficients
  • sigma2::T: Innovation variance
  • residuals::Vector{T}: Estimated residuals
  • fitted::Vector{T}: Fitted values (on differenced series)
  • loglik::T: Log-likelihood
  • aic::T: Akaike Information Criterion
  • bic::T: Bayesian Information Criterion
  • method::Symbol: Estimation method
  • converged::Bool: Whether optimization converged
  • iterations::Int: Number of iterations
source
MacroEconometricModels.ARIMAForecastType
ARIMAForecast{T}

Forecast result from an ARIMA-class model.

Fields

  • forecast::Vector{T}: Point forecasts
  • ci_lower::Vector{T}: Lower confidence interval bound
  • ci_upper::Vector{T}: Upper confidence interval bound
  • se::Vector{T}: Standard errors of forecasts
  • horizon::Int: Forecast horizon
  • conf_level::T: Confidence level (e.g., 0.95)
source
MacroEconometricModels.ARIMAOrderSelectionType
ARIMAOrderSelection{T}

Result from automatic ARIMA order selection.

Fields

  • best_p_aic::Int: Best AR order by AIC
  • best_q_aic::Int: Best MA order by AIC
  • best_p_bic::Int: Best AR order by BIC
  • best_q_bic::Int: Best MA order by BIC
  • aic_matrix::Matrix{T}: AIC values for all (p,q) combinations
  • bic_matrix::Matrix{T}: BIC values for all (p,q) combinations
  • best_model_aic::AbstractARIMAModel: Fitted model with best AIC
  • best_model_bic::AbstractARIMAModel: Fitted model with best BIC
source

VAR Models

MacroEconometricModels.VARModelType
VARModel{T} <: AbstractVARModel

VAR model estimated via OLS.

Fields: Y (data), p (lags), B (coefficients), U (residuals), Sigma (covariance), aic, bic, hqic, varnames.

source

VECM Models

MacroEconometricModels.VECMModelType
VECMModel{T} <: AbstractVARModel

Vector Error Correction Model estimated via Johansen MLE or Engle-Granger two-step.

The VECM representation: ΔYₜ = αβ'Yₜ₋₁ + Γ₁ΔYₜ₋₁ + ... + Γₚ₋₁ΔYₜ₋ₚ₊₁ + μ + uₜ

where Π = αβ' is the long-run matrix (n × n, rank r), α (n × r) are adjustment speeds, and β (n × r) are cointegrating vectors.

Fields

  • Y: Original data in levels (T_obs × n)
  • p: Underlying VAR order (VECM has p-1 lagged differences)
  • rank: Cointegrating rank r
  • alpha: Adjustment coefficients (n × r)
  • beta: Cointegrating vectors (n × r), Phillips-normalized
  • Pi: Long-run matrix αβ' (n × n)
  • Gamma: Short-run dynamics [Γ₁, ..., Γₚ₋₁]
  • mu: Intercept (n)
  • U: Residuals (T_eff × n)
  • Sigma: Residual covariance (n × n)
  • aic, bic, hqic: Information criteria
  • loglik: Log-likelihood
  • deterministic: :none, :constant, or :trend
  • method: :johansen or :engle_granger
  • johansen_result: Johansen test result (if applicable)
source
MacroEconometricModels.VECMForecastType
VECMForecast{T}

Forecast result from a VECM, preserving cointegrating relationships.

Fields

  • levels: Forecasts in levels (h × n)
  • differences: Forecasts in first differences (h × n)
  • ci_lower, ci_upper: Confidence interval bounds in levels (h × n)
  • horizon: Forecast horizon
  • ci_method: CI method used (:none, :bootstrap, :simulation)
  • conf_level: Confidence level for CIs (e.g., 0.95)
source
MacroEconometricModels.VECMGrangerResultType
VECMGrangerResult{T}

VECM Granger causality test result with short-run, long-run, and strong (joint) tests.

Fields

  • short_run_stat, short_run_pvalue, short_run_df: Wald test on Γ coefficients
  • long_run_stat, long_run_pvalue, long_run_df: Wald test on α (error correction)
  • strong_stat, strong_pvalue, strong_df: Joint test
  • cause_var, effect_var: Variable indices
source

Analysis Result Types

MacroEconometricModels.AbstractAnalysisResultType
AbstractAnalysisResult

Abstract supertype for all innovation accounting and structural analysis results. Provides a unified interface for accessing results from various methods (IRF, FEVD, HD).

Subtypes should implement:

  • point_estimate(result) - return point estimate
  • has_uncertainty(result) - return true if uncertainty bounds available
  • uncertainty_bounds(result) - return (lower, upper) bounds if available
source

Impulse Response and FEVD

MacroEconometricModels.ImpulseResponseType
ImpulseResponse{T} <: AbstractImpulseResponse

IRF results with optional confidence intervals.

Fields: values (H×n×n), cilower, ciupper, horizon, variables, shocks, citype. Internal: _draws (raw bootstrap/simulation draws for correct cumulative IRF), _conflevel.

source
MacroEconometricModels.BayesianImpulseResponseType
BayesianImpulseResponse{T} <: AbstractImpulseResponse

Bayesian IRF with posterior quantiles.

Fields: quantiles (H×n×n×q), pointestimate (H×n×n), horizon, variables, shocks, quantilelevels. Internal: _draws (raw posterior draws for correct cumulative IRF).

source

Historical Decomposition

MacroEconometricModels.HistoricalDecompositionType
HistoricalDecomposition{T} <: AbstractHistoricalDecomposition

Frequentist historical decomposition result.

Fields:

  • contributions: Shock contributions (Teff × nvars × n_shocks)
  • initial_conditions: Initial condition component (Teff × nvars)
  • actual: Actual data values (Teff × nvars)
  • shocks: Structural shocks (Teff × nshocks)
  • T_eff: Effective number of time periods
  • variables: Variable names
  • shock_names: Shock names
  • method: Identification method used
source
MacroEconometricModels.BayesianHistoricalDecompositionType
BayesianHistoricalDecomposition{T} <: AbstractHistoricalDecomposition

Bayesian historical decomposition with posterior quantiles.

Fields:

  • quantiles: Contribution quantiles (Teff × nvars × nshocks × nquantiles)
  • point_estimate: Mean contributions (Teff × nvars × n_shocks)
  • initial_quantiles: Initial condition quantiles (Teff × nvars × n_quantiles)
  • initial_point_estimate: Mean initial conditions (Teff × nvars)
  • shocks_point_estimate: Mean structural shocks (Teff × nshocks)
  • actual: Actual data values (Teff × nvars)
  • T_eff: Effective number of time periods
  • variables: Variable names
  • shock_names: Shock names
  • quantile_levels: Quantile levels (e.g., [0.16, 0.5, 0.84])
  • method: Identification method used
source

Factor Models

MacroEconometricModels.FactorModelType
FactorModel{T} <: AbstractFactorModel

Static factor model via PCA: Xₜ = Λ Fₜ + eₜ.

Fields: X, factors, loadings, eigenvalues, explainedvariance, cumulativevariance, r, standardized, block_names.

source
MacroEconometricModels.DynamicFactorModelType
DynamicFactorModel{T} <: AbstractFactorModel

Dynamic factor model: Xₜ = Λ Fₜ + eₜ, Fₜ = Σᵢ Aᵢ Fₜ₋ᵢ + ηₜ.

Fields: X, factors, loadings, A (VAR coefficients), factorresiduals, Sigmaeta, Sigmae, eigenvalues, explainedvariance, cumulative_variance, r, p, method, standardized, converged, iterations, loglik.

source
MacroEconometricModels.GeneralizedDynamicFactorModelType
GeneralizedDynamicFactorModel{T} <: AbstractFactorModel

GDFM with frequency-dependent loadings: Xₜ = χₜ + ξₜ.

Fields: X, factors, commoncomponent, idiosyncratic, loadingsspectral, spectraldensityX, spectraldensitychi, eigenvaluesspectral, frequencies, q (dynamic factors), r (static factors), bandwidth, kernel, standardized, varianceexplained.

source
MacroEconometricModels.FactorForecastType
FactorForecast{T<:AbstractFloat}

Result of factor model forecasting with optional confidence intervals.

Fields: factors, observables, factorslower, factorsupper, observableslower, observablesupper, factorsse, observablesse, horizon, conflevel, cimethod.

When ci_method == :none, CI and SE fields are zero matrices.

source

Local Projections

MacroEconometricModels.LPFEVDType
LPFEVD{T} <: AbstractFEVD

LP-based Forecast Error Variance Decomposition (Gorodnichenko & Lee 2019).

Uses R²-based estimator: regress estimated LP forecast errors on identified structural shocks to measure the share of forecast error variance attributable to each shock. Includes VAR-based bootstrap bias correction and CIs.

Fields

  • proportions: Raw FEVD estimates (n × n × H), [i,j,h] = share of variable i's h-step forecast error variance due to shock j
  • bias_corrected: Bias-corrected FEVD (n × n × H)
  • se: Bootstrap standard errors (n × n × H)
  • ci_lower: Lower CI bounds (n × n × H)
  • ci_upper: Upper CI bounds (n × n × H)
  • method: Estimator (:r2, :lpa, :lpb)
  • horizon: Maximum FEVD horizon
  • n_boot: Number of bootstrap replications used
  • conf_level: Confidence level for CIs
  • bias_correction: Whether bias correction was applied

Reference

Gorodnichenko, Y. & Lee, B. (2019). "Forecast Error Variance Decompositions with Local Projections." JBES, 38(4), 921–933.

source
MacroEconometricModels.LPForecastType
LPForecast{T}

Direct multi-step LP forecast result.

Each horizon h uses its own regression coefficients directly (no recursion), producing ŷ{T+h} = αh + βh·shockh + Γh·controlsT.

Fields:

  • forecast: Point forecasts (H × n_response)
  • ci_lower: Lower CI bounds (H × n_response)
  • ci_upper: Upper CI bounds (H × n_response)
  • se: Standard errors (H × n_response)
  • horizon: Maximum forecast horizon
  • response_vars: Response variable indices
  • shock_var: Shock variable index
  • shock_path: Assumed shock trajectory
  • conf_level: Confidence level
  • ci_method: CI method (:analytical, :bootstrap, :none)
source
MacroEconometricModels.LPImpulseResponseType
LPImpulseResponse{T} <: AbstractLPImpulseResponse

LP-based impulse response function with confidence intervals from robust standard errors.

Fields:

  • values: Point estimates (H+1 × n_response)
  • ci_lower: Lower CI bounds
  • ci_upper: Upper CI bounds
  • se: Standard errors
  • horizon: Maximum horizon
  • response_vars: Names of response variables
  • shock_var: Name of shock variable
  • cov_type: Covariance estimator type
  • conf_level: Confidence level used
source
MacroEconometricModels.LPModelType
LPModel{T} <: AbstractLPModel

Local Projection model estimated via OLS with robust standard errors (Jordà 2005).

The LP regression for horizon h: y{t+h} = αh + βh * shockt + Γh * controlst + ε_{t+h}

Fields:

  • Y: Response data matrix (Tobs × nvars)
  • shock_var: Index of shock variable in Y
  • response_vars: Indices of response variables (default: all)
  • horizon: Maximum IRF horizon H
  • lags: Number of control lags included
  • B: Vector of coefficient matrices, one per horizon h=0,...,H
  • residuals: Vector of residual matrices per horizon
  • vcov: Vector of robust covariance matrices per horizon
  • T_eff: Effective sample sizes per horizon
  • cov_estimator: Covariance estimator used
source
MacroEconometricModels.StructuralLPType
StructuralLP{T} <: AbstractFrequentistResult

Structural Local Projection result combining VAR-based identification with LP estimation.

Estimates multi-shock IRFs by computing orthogonalized structural shocks from a VAR model and using them as regressors in LP regressions (Plagborg-Møller & Wolf 2021).

Fields:

  • irf: 3D impulse responses (H × n × n) — reuses ImpulseResponse{T}
  • structural_shocks: Structural shocks (T_eff × n)
  • var_model: Underlying VAR model used for identification
  • Q: Rotation/identification matrix
  • method: Identification method used (:cholesky, :sign, :long_run, :fastica, etc.)
  • lags: Number of LP control lags
  • cov_type: HAC estimator type
  • se: Standard errors (H × n × n)
  • lp_models: Individual LP model per shock
source
MacroEconometricModels.BSplineBasisType
BSplineBasis{T} <: Any

B-spline basis for smooth LP (Barnichon & Brownlees 2019).

Fields:

  • degree: Spline degree (typically 3 for cubic)
  • ninteriorknots: Number of interior knots
  • knots: Full knot vector including boundary knots
  • basismatrix: Precomputed basis matrix at horizon points (H+1 × nbasis)
  • horizons: Horizon points where basis is evaluated
source
MacroEconometricModels.LPIVModelType
LPIVModel{T} <: AbstractLPModel

Local Projection with Instrumental Variables (Stock & Watson 2018). Uses 2SLS estimation at each horizon.

Fields:

  • Y: Response data matrix
  • shock_var: Index of endogenous shock variable
  • response_vars: Indices of response variables
  • instruments: Instrument matrix (T × n_instruments)
  • horizon: Maximum horizon
  • lags: Number of control lags
  • B: 2SLS coefficient matrices per horizon
  • residuals: Residuals per horizon
  • vcov: Robust covariance matrices per horizon
  • firststageF: First-stage F-statistics per horizon (for weak IV test)
  • firststagecoef: First-stage coefficients per horizon
  • T_eff: Effective sample sizes
  • cov_estimator: Covariance estimator used
source
MacroEconometricModels.PropensityLPModelType
PropensityLPModel{T} <: AbstractLPModel

Local Projection with Inverse Propensity Weighting (Angrist et al. 2018).

Estimates Average Treatment Effect (ATE) at each horizon using IPW.

Fields:

  • Y: Response data matrix
  • treatment: Binary treatment indicator vector
  • response_vars: Response variable indices
  • covariates: Covariate matrix for propensity model
  • horizon: Maximum horizon
  • propensity_scores: Estimated propensity scores P(D=1|X)
  • ipw_weights: Inverse propensity weights
  • B: IPW-weighted regression coefficients per horizon
  • residuals: Residuals per horizon
  • vcov: Robust covariance matrices per horizon
  • ate: Average treatment effects per horizon (for each response var)
  • ate_se: Standard errors of ATE
  • config: Propensity score configuration
  • T_eff: Effective sample sizes
  • cov_estimator: Covariance estimator used
source
MacroEconometricModels.PropensityScoreConfigType
PropensityScoreConfig{T} <: Any

Configuration for propensity score estimation and IPW.

Fields:

  • method: Propensity model (:logit, :probit)
  • trimming: (lower, upper) bounds for propensity scores
  • normalize: Normalize weights to sum to 1 within groups
source
MacroEconometricModels.SmoothLPModelType
SmoothLPModel{T} <: AbstractLPModel

Smooth Local Projection with B-spline basis (Barnichon & Brownlees 2019).

The IRF is parameterized as: β(h) = Σj θj Bj(h) where Bj are B-spline basis functions.

Fields:

  • Y: Response data matrix
  • shock_var: Shock variable index
  • response_vars: Response variable indices
  • horizon: Maximum horizon
  • lags: Number of control lags
  • spline_basis: B-spline basis configuration
  • theta: Spline coefficients (nbasis × nresponse)
  • vcov_theta: Covariance of theta (vectorized)
  • lambda: Smoothing penalty parameter
  • irfvalues: Smoothed IRF point estimates (H+1 × nresponse)
  • irf_se: Standard errors of smoothed IRF
  • residuals: Pooled residuals
  • T_eff: Effective sample size
  • cov_estimator: Covariance estimator used
source
MacroEconometricModels.StateLPModelType
StateLPModel{T} <: AbstractLPModel

State-dependent Local Projection (Auerbach & Gorodnichenko 2013).

Model: y{t+h} = F(zt)[αE + βE * shockt + ...] + (1-F(zt))[αR + βR * shock_t + ...]

F(z) is a smooth transition function, typically logistic. State E = expansion (high z), State R = recession (low z).

Fields:

  • Y: Response data matrix
  • shock_var: Shock variable index
  • response_vars: Response variable indices
  • horizon: Maximum horizon
  • lags: Number of control lags
  • state: StateTransition configuration
  • B_expansion: Coefficients in expansion state (per horizon)
  • B_recession: Coefficients in recession state (per horizon)
  • residuals: Residuals per horizon
  • vcov_expansion: Covariance in expansion (per horizon)
  • vcov_recession: Covariance in recession (per horizon)
  • vcov_diff: Covariance of difference (per horizon)
  • T_eff: Effective sample sizes
  • cov_estimator: Covariance estimator used
source
MacroEconometricModels.StateTransitionType
StateTransition{T} <: Any

Smooth state transition function for state-dependent LP.

F(zt) = exp(-γ(zt - c)) / (1 + exp(-γ(z_t - c)))

Fields:

  • state_var: State variable values (standardized)
  • gamma: Transition smoothness parameter (higher = sharper)
  • threshold: Transition threshold c
  • method: Transition function type (:logistic, :exponential, :indicator)
  • F_values: Precomputed transition function values
source

Panel VAR Types

MacroEconometricModels.PVARModelType
PVARModel{T} <: StatsAPI.RegressionModel

Panel VAR model estimated via GMM or FE-OLS.

Stores coefficient matrices, robust standard errors, GMM internals for specification tests, and panel descriptors. GMM internals (instruments, weighting matrix, residuals) are retained to support Hansen J-test, bootstrap, and Andrews-Lu MMSC without re-estimation.

Fields

  • Phi::Matrix{T} — m × K coefficient matrix (rows = equations, K = m*p + npredet + nexog [+ 1])
  • Sigma::Matrix{T} — m × m residual covariance (from level residuals)
  • se::Matrix{T} — same shape as Phi (robust SEs, Windmeijer-corrected for 2-step)
  • pvalues::Matrix{T} — same shape as Phi
  • m::Int — number of endogenous variables
  • p::Int — number of lags
  • n_predet::Int — number of predetermined variables
  • n_exog::Int — number of strictly exogenous variables
  • varnames::Vector{String} — endogenous variable names
  • predet_names::Vector{String} — predetermined variable names
  • exog_names::Vector{String} — exogenous variable names
  • method::Symbol — :fdgmm, :systemgmm, :fe_ols
  • transformation::Symbol — :fd, :fod, :demean
  • steps::Symbol — :onestep, :twostep, :mstep
  • system_constant::Bool — whether level equation includes a constant
  • n_groups::Int — number of panel groups
  • n_periods::Int — number of time periods (max)
  • n_obs::Int — total effective observations
  • obs_per_group::NamedTuple{(:min,:avg,:max), Tuple{Int,Float64,Int}}
  • instruments::Vector{Matrix{T}} — per-group instrument matrices
  • residuals_transformed::Vector{Matrix{T}} — per-group transformed residuals
  • weighting_matrix::Matrix{T} — final weighting matrix W
  • n_instruments::Int — number of moment conditions
  • data::PanelData{T} — original panel data

References

  • Holtz-Eakin, Newey & Rosen (1988), Econometrica 56(6), 1371-1395.
  • Arellano & Bond (1991), Review of Economic Studies 58(2), 277-297.
  • Blundell & Bond (1998), Journal of Econometrics 87(1), 115-143.
source
MacroEconometricModels.PVARStabilityType
PVARStability{T} <: Any

Eigenvalue stability analysis for a PVARModel.

Fields

  • eigenvalues::Vector{Complex{T}} — eigenvalues of companion matrix
  • moduli::Vector{T} — moduli |λ|
  • is_stable::Bool — true if all |λ| < 1
source
MacroEconometricModels.PVARTestResultType
PVARTestResult{T} <: StatsAPI.HypothesisTest

Specification test result for Panel VAR (Hansen J-test, etc.).

Fields

  • test_name::String — e.g. "Hansen J-test"
  • statistic::T — test statistic value
  • pvalue::T — p-value
  • df::Int — degrees of freedom
  • n_instruments::Int — number of instruments (moment conditions)
  • n_params::Int — number of estimated parameters
source

Difference-in-Differences Types

MacroEconometricModels.DIDResultType
DIDResult{T} <: AbstractFrequentistResult

Difference-in-Differences estimation result.

Stores event-study ATT coefficients, confidence intervals, and optionally group-time ATTs for Callaway-Sant'Anna. All DiD methods return this type.

Fields

  • att::Vector{T} — ATT by event-time
  • se::Vector{T} — standard errors
  • ci_lower::Vector{T} — lower CI bounds
  • ci_upper::Vector{T} — upper CI bounds
  • event_times::Vector{Int} — event-time grid (e.g., [-3,-2,-1,0,1,...,H])
  • reference_period::Int — omitted period (typically -1)
  • group_time_att::Union{Matrix{T}, Nothing} — ncohorts x nperiods (CS only)
  • cohorts::Union{Vector{Int}, Nothing} — treatment cohort identifiers
  • overall_att::T — single aggregate ATT
  • overall_se::T — SE of aggregate ATT
  • n_obs::Int — total observations
  • n_groups::Int — number of panel units
  • n_treated::Int — number of ever-treated units
  • n_control::Int — number of never-treated units
  • method::Symbol — :twfe or :callaway_santanna
  • outcome_var::String — outcome variable name
  • treatment_var::String — treatment variable name
  • control_group::Symbol — :nevertreated or :notyet_treated
  • cluster::Symbol — clustering level (:unit, :time, :twoway)
  • conf_level::T — confidence level

References

  • Callaway, B. & Sant'Anna, P. H. C. (2021). JoE 225(2), 200-230.
  • Goodman-Bacon, A. (2021). JoE 225(2), 254-277.
source
MacroEconometricModels.EventStudyLPType
EventStudyLP{T<:AbstractFloat}

Event Study Local Projection result with panel fixed effects.

Stores dynamic treatment effect coefficients at each event-time horizon, along with per-horizon regression details for diagnostics.

Fields

  • coefficients::Vector{T} — beta_h for h = -leads, ..., 0, ..., H
  • se::Vector{T} — standard errors
  • ci_lower::Vector{T} — lower CI bounds
  • ci_upper::Vector{T} — upper CI bounds
  • event_times::Vector{Int} — event-time grid
  • reference_period::Int — omitted period (typically -1)
  • B::Vector{Matrix{T}} — full coefficient matrices per horizon
  • residuals_per_h::Vector{Matrix{T}} — residuals per horizon
  • vcov::Vector{Matrix{T}} — VCV matrices per horizon
  • T_eff::Vector{Int} — effective obs per horizon
  • outcome_var::String — outcome variable name
  • treatment_var::String — treatment variable name
  • n_obs::Int — total observations
  • n_groups::Int — number of panel units
  • lags::Int — number of control lags
  • leads::Int — number of pre-treatment leads
  • horizon::Int — post-treatment horizon H
  • clean_controls::Bool — LP-DiD flag (true = only not-yet-treated controls)
  • cluster::Symbol — clustering level
  • conf_level::T — confidence level
  • data::PanelData{T} — original data

References

  • Jorda, O. (2005). AER 95(1), 161-182.
  • Dube, A. et al. (2025). JAE.
source
MacroEconometricModels.BaconDecompositionType
BaconDecomposition{T<:AbstractFloat}

Goodman-Bacon (2021) decomposition of the TWFE DiD estimator.

Decomposes the TWFE estimate into a weighted average of all possible 2x2 DiD comparisons. Weights reflect sample size and variance of treatment.

Fields

  • estimates::Vector{T} — 2x2 DiD estimates
  • weights::Vector{T} — corresponding weights (sum to 1)
  • comparison_type::Vector{Symbol} — :earliervslater, :latervsearlier, :treatedvsuntreated
  • cohort_i::Vector{Int} — first cohort in each 2x2
  • cohort_j::Vector{Int} — second cohort (or 0 for never-treated)
  • overall_att::T — weighted average = TWFE estimate

Reference

Goodman-Bacon, A. (2021). JoE 225(2), 254-277.

source
MacroEconometricModels.PretrendTestResultType
PretrendTestResult{T<:AbstractFloat}

Joint F-test result for parallel trends assumption.

Tests H0: all pre-treatment event-time coefficients are jointly zero. A rejection suggests violation of parallel trends.

Fields

  • statistic::T — F-statistic (or Wald chi-squared)
  • pvalue::T — p-value
  • df::Int — degrees of freedom (number of pre-treatment periods)
  • pre_coefficients::Vector{T} — pre-treatment coefficients
  • pre_se::Vector{T} — SEs of pre-treatment coefficients
  • test_type::Symbol — :f_test or :wald
source
MacroEconometricModels.NegativeWeightResultType
NegativeWeightResult{T<:AbstractFloat}

de Chaisemartin & D'Haultfoeuille (2020) negative weight diagnostic.

Checks whether the TWFE estimator places negative weights on some group-time ATTs, which can cause sign reversal of the overall estimate.

Fields

  • has_negative_weights::Bool — true if any weights are negative
  • n_negative::Int — count of negative weights
  • total_negative_weight::T — sum of negative weights
  • weights::Vector{T} — all weights
  • cohort_time_pairs::Vector{Tuple{Int,Int}} — (cohort, time) for each weight
source
MacroEconometricModels.HonestDiDResultType
HonestDiDResult{T<:AbstractFloat}

Rambachan & Roth (2023) HonestDiD sensitivity analysis result.

Provides robust confidence sets under bounded violations of parallel trends. The Mbar parameter controls the maximum allowed violation magnitude.

Fields

  • Mbar::T — violation bound used
  • robust_ci_lower::Vector{T} — robust CI lower bounds per post-period
  • robust_ci_upper::Vector{T} — robust CI upper bounds per post-period
  • original_ci_lower::Vector{T} — original CIs for comparison
  • original_ci_upper::Vector{T}
  • breakdown_value::T — smallest Mbar making result insignificant
  • post_event_times::Vector{Int} — post-treatment event-time grid
  • post_att::Vector{T} — post-treatment point estimates
  • conf_level::T

Reference

Rambachan, A. & Roth, J. (2023). RES 90(5), 2555-2591.

source

GMM Types

MacroEconometricModels.GMMModelType
GMMModel{T} <: AbstractGMMModel

Generalized Method of Moments estimator.

Minimizes: g(θ)'W g(θ) where g(θ) = (1/n) Σᵢ gᵢ(θ)

Fields:

  • theta: Parameter estimates
  • vcov: Asymptotic covariance matrix
  • n_moments: Number of moment conditions
  • n_params: Number of parameters
  • n_obs: Number of observations
  • weighting: Weighting specification
  • W: Final weighting matrix
  • g_bar: Sample moment vector at solution
  • J_stat: Hansen's J-test statistic
  • J_pvalue: p-value for J-test
  • converged: Convergence flag
  • iterations: Number of iterations
source
MacroEconometricModels.SMMModelType
SMMModel{T} <: AbstractGMMModel

Simulated Method of Moments estimator.

Shares the AbstractGMMModel interface with GMMModel –- coef, vcov, nobs, stderror, show, refs, report, j_test all work.

Fields

  • theta::Vector{T} –- estimated parameters
  • vcov::Matrix{T} –- asymptotic covariance matrix
  • n_moments::Int –- number of moment conditions
  • n_params::Int –- number of parameters
  • n_obs::Int –- number of data observations
  • weighting::GMMWeighting{T} –- weighting specification
  • W::Matrix{T} –- final weighting matrix
  • g_bar::Vector{T} –- moment discrepancy at solution
  • J_stat::T –- Hansen J-test statistic
  • J_pvalue::T –- J-test p-value
  • converged::Bool –- convergence flag
  • iterations::Int –- optimizer iterations
  • sim_ratio::Int –- tau = simulation periods / data periods
source
MacroEconometricModels.GMMWeightingType
GMMWeighting{T} <: Any

GMM weighting matrix specification.

Fields:

  • method: Weighting method (:identity, :optimal, :two_step, :iterated)
  • max_iter: Maximum iterations for iterated GMM
  • tol: Convergence tolerance
source

Prior Types


Bayesian Posterior Types

MacroEconometricModels.BVARPosteriorType
BVARPosterior{T} <: Any

Posterior draws from Bayesian VAR estimation.

Replaces MCMCChains.Chains — stores i.i.d. or Gibbs draws from the Normal-Inverse-Wishart posterior directly.

Fields

  • B_draws::Array{T,3}: Coefficient draws (n_draws × k × n)
  • Sigma_draws::Array{T,3}: Covariance draws (n_draws × n × n)
  • n_draws::Int: Number of posterior draws
  • p::Int: Number of VAR lags
  • n::Int: Number of variables
  • data::Matrix{T}: Original Y matrix (for residual computation downstream)
  • prior::Symbol: Prior used (:normal or :minnesota)
  • sampler::Symbol: Sampler used (:direct or :gibbs)
  • varnames::Vector{String}: Variable names
source

Forecast Types

MacroEconometricModels.AbstractForecastResultType
AbstractForecastResult{T<:AbstractFloat}

Abstract supertype for all forecast result types. Subtypes: ARIMAForecast, VolatilityForecast, LPForecast, VECMForecast, FactorForecast.

All subtypes have at least a horizon::Int field.

source
MacroEconometricModels.VARForecastType
VARForecast{T} <: AbstractForecastResult{T}

VAR model forecast with optional bootstrap confidence intervals.

Fields: forecast (h×n), cilower (h×n), ciupper (h×n), horizon, cimethod, conflevel, varnames.

source
MacroEconometricModels.BVARForecastType
BVARForecast{T} <: AbstractForecastResult{T}

Bayesian VAR forecast with posterior credible intervals.

Fields: forecast (h×n), cilower (h×n), ciupper (h×n), horizon, conflevel, pointestimate, varnames.

source

Covariance Estimators

MacroEconometricModels.NeweyWestEstimatorType
NeweyWestEstimator{T} <: AbstractCovarianceEstimator

Newey-West HAC covariance estimator configuration.

Fields:

  • bandwidth: Truncation lag (0 = automatic via Newey-West 1994 formula)
  • kernel: Kernel function (:bartlett, :parzen, :quadraticspectral, :tukeyhanning)
  • prewhiten: Use AR(1) prewhitening
source

Unit Root Test Types

MacroEconometricModels.ADFResultType
ADFResult{T} <: AbstractUnitRootTest

Augmented Dickey-Fuller test result.

Fields:

  • statistic: ADF test statistic (t-ratio on γ)
  • pvalue: Approximate p-value (MacKinnon 1994, 2010)
  • lags: Number of augmenting lags used
  • regression: Regression specification (:none, :constant, :trend)
  • critical_values: Critical values at 1%, 5%, 10% levels
  • nobs: Effective number of observations
source
MacroEconometricModels.KPSSResultType
KPSSResult{T} <: AbstractUnitRootTest

KPSS stationarity test result.

Fields:

  • statistic: KPSS test statistic
  • pvalue: Approximate p-value
  • regression: Regression specification (:constant, :trend)
  • critical_values: Critical values at 1%, 5%, 10% levels
  • bandwidth: Bartlett kernel bandwidth used
  • nobs: Number of observations
source
MacroEconometricModels.PPResultType
PPResult{T} <: AbstractUnitRootTest

Phillips-Perron test result.

Fields:

  • statistic: PP test statistic (Zt or Zα)
  • pvalue: Approximate p-value
  • regression: Regression specification (:none, :constant, :trend)
  • critical_values: Critical values at 1%, 5%, 10% levels
  • bandwidth: Newey-West bandwidth used
  • nobs: Effective number of observations
source
MacroEconometricModels.ZAResultType
ZAResult{T} <: AbstractUnitRootTest

Zivot-Andrews structural break unit root test result.

Fields:

  • statistic: Minimum t-statistic across all break points
  • pvalue: Approximate p-value
  • break_index: Index of estimated structural break
  • break_fraction: Break point as fraction of sample
  • regression: Break specification (:constant, :trend, :both)
  • critical_values: Critical values at 1%, 5%, 10% levels
  • lags: Number of augmenting lags
  • nobs: Effective number of observations
source
MacroEconometricModels.NgPerronResultType
NgPerronResult{T} <: AbstractUnitRootTest

Ng-Perron unit root test result (MZα, MZt, MSB, MPT).

Fields:

  • MZa: Modified Zα statistic
  • MZt: Modified Zt statistic
  • MSB: Modified Sargan-Bhargava statistic
  • MPT: Modified Point-optimal statistic
  • regression: Regression specification (:constant, :trend)
  • critical_values: Dict mapping statistic name to critical values
  • nobs: Effective number of observations
source
MacroEconometricModels.JohansenResultType
JohansenResult{T} <: AbstractUnitRootTest

Johansen cointegration test result.

Fields:

  • trace_stats: Trace test statistics for each rank
  • trace_pvalues: P-values for trace tests
  • max_eigen_stats: Maximum eigenvalue test statistics
  • max_eigen_pvalues: P-values for max eigenvalue tests
  • rank: Estimated cointegration rank (at 5% level)
  • eigenvectors: Cointegrating vectors (β), columns are vectors
  • adjustment: Adjustment coefficients (α)
  • eigenvalues: Eigenvalues from reduced rank regression
  • critical_values_trace: Critical values for trace test (rows: ranks, cols: 10%, 5%, 1%)
  • critical_values_max: Critical values for max eigenvalue test
  • deterministic: Deterministic specification
  • lags: Number of lags in VECM
  • nobs: Effective number of observations
source
MacroEconometricModels.VARStationarityResultType
VARStationarityResult{T}

VAR model stationarity check result.

Fields:

  • is_stationary: true if all eigenvalues have modulus < 1
  • eigenvalues: Eigenvalues of companion matrix (may be real or complex)
  • max_modulus: Maximum eigenvalue modulus
  • companion_matrix: The companion form matrix F
source

Model Comparison Types

MacroEconometricModels.LRTestResultType
LRTestResult{T} <: StatsAPI.HypothesisTest

Result from a likelihood ratio test comparing nested models.

Fields

  • statistic::T: LR statistic = -2(ℓR - ℓU)
  • pvalue::T: p-value from χ²(df) distribution
  • df::Int: Degrees of freedom (dofU - dofR)
  • loglik_restricted::T: Log-likelihood of restricted model
  • loglik_unrestricted::T: Log-likelihood of unrestricted model
  • dof_restricted::Int: Parameters in restricted model
  • dof_unrestricted::Int: Parameters in unrestricted model
  • nobs_restricted::Int: Observations in restricted model
  • nobs_unrestricted::Int: Observations in unrestricted model
source
MacroEconometricModels.LMTestResultType
LMTestResult{T} <: StatsAPI.HypothesisTest

Result from a Lagrange multiplier (score) test comparing nested models.

Fields

  • statistic::T: LM statistic = s'(-H)⁻¹s
  • pvalue::T: p-value from χ²(df) distribution
  • df::Int: Degrees of freedom (dofU - dofR)
  • nobs::Int: Number of observations
  • score_norm::T: ‖s‖₂ diagnostic (Euclidean norm of score vector)
source

Granger Causality Types

MacroEconometricModels.GrangerCausalityResultType
GrangerCausalityResult{T} <: StatsAPI.HypothesisTest

Result from a Granger causality test in a VAR model.

Fields

  • statistic::T: Wald χ² statistic
  • pvalue::T: p-value from χ²(df) distribution
  • df::Int: Degrees of freedom (number of restrictions)
  • cause::Vector{Int}: Indices of causing variable(s)
  • effect::Int: Index of effect variable
  • n::Int: Number of variables in VAR
  • p::Int: Lag order
  • nobs::Int: Effective number of observations
  • test_type::Symbol: :pairwise or :block
source

Nowcasting Types

MacroEconometricModels.NowcastDFMType
NowcastDFM{T<:AbstractFloat} <: AbstractNowcastModel

Dynamic factor model nowcasting result (Bańbura & Modugno 2014).

Estimates factors from mixed-frequency data with arbitrary missing patterns using EM algorithm + Kalman smoother.

Fields

  • X_sm::Matrix{T} — smoothed data (NaN filled)
  • F::Matrix{T} — smoothed factors (Tobs × statedim)
  • C::Matrix{T} — observation loadings
  • A::Matrix{T} — state transition matrix
  • Q::Matrix{T} — state innovation covariance
  • R::Matrix{T} — observation noise covariance (diagonal)
  • Mx::Vector{T} — data column means (for standardization)
  • Wx::Vector{T} — data column stds
  • Z_0::Vector{T} — initial state mean
  • V_0::Matrix{T} — initial state covariance
  • r::Int — number of factors
  • p::Int — VAR lags in factor dynamics
  • blocks::Matrix{Int} — block structure (N × n_blocks)
  • loglik::T — log-likelihood at convergence
  • n_iter::Int — EM iterations used
  • nM::Int — number of monthly variables
  • nQ::Int — number of quarterly variables
  • idio::Symbol — idiosyncratic spec (:ar1 or :iid)
  • data::Matrix{T} — original data with NaN
source
MacroEconometricModels.NowcastBVARType
NowcastBVAR{T<:AbstractFloat} <: AbstractNowcastModel

Large Bayesian VAR nowcasting result (Cimadomo et al. 2022).

Uses GLP-style normal-inverse-Wishart prior with hyperparameter optimization via marginal likelihood maximization.

Fields

  • X_sm::Matrix{T} — smoothed data (NaN filled)
  • beta::Matrix{T} — posterior mode VAR coefficients
  • sigma::Matrix{T} — posterior mode error covariance
  • lambda::T — overall shrinkage
  • theta::T — cross-variable shrinkage
  • miu::T — sum-of-coefficients prior weight
  • alpha::T — co-persistence prior weight
  • lags::Int — number of lags
  • loglik::T — marginal log-likelihood
  • nM::Int — number of monthly variables
  • nQ::Int — number of quarterly variables
  • data::Matrix{T} — original data with NaN
source
MacroEconometricModels.NowcastBridgeType
NowcastBridge{T<:AbstractFloat} <: AbstractNowcastModel

Bridge equation combination nowcasting result (Bańbura et al. 2023).

Combines multiple OLS bridge regressions (each using a pair of monthly indicators) via median combination.

Fields

  • X_sm::Matrix{T} — smoothed data (NaN filled by interpolation)
  • Y_nowcast::Vector{T} — combined nowcast for target variable (per quarter)
  • Y_individual::Matrix{T} — individual equation nowcasts (nquarters × nequations)
  • n_equations::Int — number of bridge equations
  • coefficients::Vector{Vector{T}} — OLS coefficients per equation
  • nM::Int — number of monthly variables
  • nQ::Int — number of quarterly variables
  • lagM::Int — monthly indicator lags
  • lagQ::Int — quarterly indicator lags
  • lagY::Int — autoregressive lags
  • data::Matrix{T} — original data with NaN
source
MacroEconometricModels.NowcastResultType
NowcastResult{T<:AbstractFloat}

Unified nowcast result wrapping any AbstractNowcastModel.

Fields

  • model::AbstractNowcastModel — underlying model
  • X_sm::Matrix{T} — smoothed/nowcasted data
  • target_index::Int — column index of target variable
  • nowcast::T — current-quarter nowcast value
  • forecast::T — next-quarter forecast value
  • method::Symbol:dfm, :bvar, or :bridge
source
MacroEconometricModels.NowcastNewsType
NowcastNews{T<:AbstractFloat}

News decomposition result (Bańbura & Modugno 2014).

Decomposes nowcast revision into contributions from new data releases (news), data revisions, and parameter re-estimation.

Fields

  • old_nowcast::T — previous nowcast value
  • new_nowcast::T — updated nowcast value
  • impact_news::Vector{T} — per-release news impact
  • impact_revision::T — data revision impact
  • impact_reestimation::T — parameter re-estimation impact (residual)
  • group_impacts::Vector{T} — news aggregated by variable group
  • variable_names::Vector{String} — names for each news release
source

SVAR Identification Types

MacroEconometricModels.SignIdentifiedSetType
SignIdentifiedSet{T} <: AbstractAnalysisResult

Full identified set from sign-restricted SVAR identification.

Stores all accepted rotation matrices and corresponding IRFs, enabling characterization of the identified set (Baumeister & Hamilton, 2015).

Fields:

  • Q_draws::Vector{Matrix{T}} — accepted rotation matrices
  • irf_draws::Array{T,4} — stacked IRFs (n_accepted × horizon × n × n)
  • n_accepted::Int — number of accepted draws
  • n_total::Int — total draws attempted
  • acceptance_rate::T — fraction accepted
  • variables::Vector{String} — variable names
  • shocks::Vector{String} — shock names
source
MacroEconometricModels.UhligSVARResultType
UhligSVARResult{T<:AbstractFloat}

Result from Mountford-Uhlig (2009) penalty function identification.

Fields

  • Q::Matrix{T}: Optimal rotation matrix
  • irf::Array{T,3}: Impulse responses (horizon × n × n)
  • penalty::T: Total penalty at optimum (negative = better)
  • shock_penalties::Vector{T}: Per-shock penalty values
  • restrictions::SVARRestrictions: The imposed restrictions
  • converged::Bool: Whether all sign restrictions are satisfied
source

Volatility Models

MacroEconometricModels.ARCHModelType
ARCHModel{T} <: AbstractVolatilityModel

ARCH(q) model (Engle 1982): εₜ = σₜ zₜ, σ²ₜ = ω + α₁ε²ₜ₋₁ + ... + αqε²ₜ₋q

Fields

  • y::Vector{T}: Original data
  • q::Int: ARCH order
  • mu::T: Mean (intercept)
  • omega::T: Variance intercept (ω > 0)
  • alpha::Vector{T}: ARCH coefficients [α₁, ..., αq]
  • conditional_variance::Vector{T}: Estimated conditional variances σ²ₜ
  • standardized_residuals::Vector{T}: Standardized residuals zₜ = εₜ/σₜ
  • residuals::Vector{T}: Raw residuals εₜ = yₜ - μ
  • fitted::Vector{T}: Fitted values (mean)
  • loglik::T: Log-likelihood
  • aic::T: Akaike Information Criterion
  • bic::T: Bayesian Information Criterion
  • method::Symbol: Estimation method
  • converged::Bool: Whether optimization converged
  • iterations::Int: Number of iterations
source
MacroEconometricModels.GARCHModelType
GARCHModel{T} <: AbstractVolatilityModel

GARCH(p,q) model (Bollerslev 1986): σ²ₜ = ω + α₁ε²ₜ₋₁ + ... + αqε²ₜ₋q + β₁σ²ₜ₋₁ + ... + βpσ²ₜ₋p

Fields

  • y::Vector{T}: Original data
  • p::Int: GARCH order (lagged variances)
  • q::Int: ARCH order (lagged squared residuals)
  • mu::T: Mean (intercept)
  • omega::T: Variance intercept (ω > 0)
  • alpha::Vector{T}: ARCH coefficients [α₁, ..., αq]
  • beta::Vector{T}: GARCH coefficients [β₁, ..., βp]
  • conditional_variance::Vector{T}: Estimated conditional variances σ²ₜ
  • standardized_residuals::Vector{T}: Standardized residuals zₜ = εₜ/σₜ
  • residuals::Vector{T}: Raw residuals εₜ = yₜ - μ
  • fitted::Vector{T}: Fitted values (mean)
  • loglik::T: Log-likelihood
  • aic::T: Akaike Information Criterion
  • bic::T: Bayesian Information Criterion
  • method::Symbol: Estimation method
  • converged::Bool: Whether optimization converged
  • iterations::Int: Number of iterations
source
MacroEconometricModels.EGARCHModelType
EGARCHModel{T} <: AbstractVolatilityModel

EGARCH(p,q) model (Nelson 1991): log(σ²ₜ) = ω + Σαᵢ(|zₜ₋ᵢ| - E|zₜ₋ᵢ|) + Σγᵢzₜ₋ᵢ + Σβⱼlog(σ²ₜ₋ⱼ)

The log specification ensures σ² > 0 without parameter constraints, and γᵢ captures leverage effects (typically γ < 0).

source
MacroEconometricModels.GJRGARCHModelType
GJRGARCHModel{T} <: AbstractVolatilityModel

GJR-GARCH(p,q) model (Glosten, Jagannathan & Runkle 1993): σ²ₜ = ω + Σ(αᵢ + γᵢI(εₜ₋ᵢ < 0))ε²ₜ₋ᵢ + Σβⱼσ²ₜ₋ⱼ

γᵢ > 0 means negative shocks increase variance more than positive shocks.

source
MacroEconometricModels.SVModelType
SVModel{T} <: AbstractVolatilityModel

Stochastic Volatility model (Taylor 1986), estimated via Kim-Shephard-Chib (1998) Gibbs sampler: yₜ = exp(hₜ/2) εₜ, εₜ ~ N(0,1) hₜ = μ + φ(hₜ₋₁ - μ) + σ_η ηₜ, ηₜ ~ N(0,1)

Fields

  • y::Vector{T}: Original data
  • h_draws::Matrix{T}: Posterior draws of latent log-volatilities (nsamples × nobs)
  • mu_post::Vector{T}: Posterior draws of μ (log-variance level)
  • phi_post::Vector{T}: Posterior draws of φ (persistence)
  • sigma_eta_post::Vector{T}: Posterior draws of σ_η (volatility of volatility)
  • volatility_mean::Vector{T}: Posterior mean of exp(hₜ) at each time t
  • volatility_quantiles::Matrix{T}: Quantiles of exp(hₜ) (T × n_quantiles)
  • quantile_levels::Vector{T}: Quantile levels (e.g., [0.025, 0.5, 0.975])
  • dist::Symbol: Error distribution (:normal or :studentt)
  • leverage::Bool: Whether leverage effect was estimated
  • n_samples::Int: Number of posterior samples
source
MacroEconometricModels.VolatilityForecastType
VolatilityForecast{T}

Forecast result from a volatility model.

Fields

  • forecast::Vector{T}: Point forecasts of conditional variance
  • ci_lower::Vector{T}: Lower confidence interval bound
  • ci_upper::Vector{T}: Upper confidence interval bound
  • se::Vector{T}: Standard errors of forecasts
  • horizon::Int: Forecast horizon
  • conf_level::T: Confidence level (e.g., 0.95)
  • model_type::Symbol: Source model type (:arch, :garch, :egarch, :gjr_garch, :sv)
source

Cross-Sectional Models

MacroEconometricModels.RegModelType
RegModel{T} <: StatsAPI.RegressionModel

Linear regression model estimated via OLS, WLS, or IV/2SLS.

Fields

  • y::Vector{T} — dependent variable
  • X::Matrix{T} — regressor matrix (includes intercept if present)
  • beta::Vector{T} — estimated coefficients
  • vcov_mat::Matrix{T} — variance-covariance matrix of coefficients
  • residuals::Vector{T} — OLS/WLS residuals
  • fitted::Vector{T} — fitted values X * beta
  • ssr::T — sum of squared residuals
  • tss::T — total sum of squares (demeaned)
  • r2::T — R-squared
  • adj_r2::T — adjusted R-squared
  • f_stat::T — F-statistic for joint significance
  • f_pval::T — p-value of the F-test
  • loglik::T — Gaussian log-likelihood
  • aic::T — Akaike information criterion
  • bic::T — Bayesian information criterion
  • varnames::Vector{String} — coefficient names
  • method::Symbol — estimation method (:ols, :wls, :iv)
  • cov_type::Symbol — covariance estimator (:ols, :hc0, :hc1, :hc2, :hc3, :cluster)
  • weights::Union{Nothing,Vector{T}} — WLS weights (nothing for OLS)
  • Z::Union{Nothing,Matrix{T}} — instrument matrix (IV only)
  • endogenous::Union{Nothing,Vector{Int}} — indices of endogenous regressors (IV only)
  • first_stage_f::Union{Nothing,T} — first-stage F-statistic (IV only)
  • sargan_stat::Union{Nothing,T} — Sargan overidentification statistic (IV only)
  • sargan_pval::Union{Nothing,T} — Sargan test p-value (IV only)

References

  • White, H. (1980). Econometrica 48(4), 817-838.
  • MacKinnon, J. G. & White, H. (1985). JBES 3(3), 305-314.
source
MacroEconometricModels.LogitModelType
LogitModel{T} <: StatsAPI.RegressionModel

Binary logistic regression model estimated via maximum likelihood (IRLS).

Fields

  • y::Vector{T} — binary dependent variable (0/1)
  • X::Matrix{T} — regressor matrix
  • beta::Vector{T} — estimated coefficients
  • vcov_mat::Matrix{T} — variance-covariance matrix
  • residuals::Vector{T} — deviance residuals
  • fitted::Vector{T} — predicted probabilities P(y=1|X)
  • loglik::T — maximized log-likelihood
  • loglik_null::T — null model log-likelihood
  • pseudo_r2::T — McFadden's pseudo R-squared
  • aic::T — Akaike information criterion
  • bic::T — Bayesian information criterion
  • varnames::Vector{String} — coefficient names
  • converged::Bool — whether IRLS converged
  • iterations::Int — number of IRLS iterations
  • cov_type::Symbol — covariance estimator (:ols, :hc1, etc.)

References

  • McCullagh, P. & Nelder, J. A. (1989). Generalized Linear Models. Chapman & Hall.
  • Agresti, A. (2002). Categorical Data Analysis. 2nd ed. Wiley.
source
MacroEconometricModels.ProbitModelType
ProbitModel{T} <: StatsAPI.RegressionModel

Binary probit regression model estimated via maximum likelihood (IRLS).

Fields

Same as LogitModel{T}, using the standard normal CDF as the link function.

References

  • Wooldridge, J. M. (2010). Econometric Analysis of Cross Section and Panel Data. 2nd ed. MIT Press.
source
MacroEconometricModels.MarginalEffectsType
MarginalEffects{T}

Marginal effects computed from a Logit or Probit model.

Fields

  • effects::Vector{T} — marginal effects (AME, MEM, or MER)
  • se::Vector{T} — delta-method standard errors
  • z_stat::Vector{T} — z-statistics
  • p_values::Vector{T} — two-sided p-values (normal distribution)
  • ci_lower::Vector{T} — lower CI bounds
  • ci_upper::Vector{T} — upper CI bounds
  • varnames::Vector{String} — variable names
  • type::Symbol — :ame (average), :mem (at-mean), or :mer (at-representative)
  • conf_level::T — confidence level

References

  • Cameron, A. C. & Trivedi, P. K. (2005). Microeconometrics. Cambridge University Press.
source

Non-Gaussian SVAR Types

MacroEconometricModels.NormalityTestResultType
NormalityTestResult{T} <: AbstractNormalityTest

Result of a multivariate normality test.

Fields:

  • test_name::Symbol:jarque_bera, :mardia_skewness, :mardia_kurtosis, :doornik_hansen, :henze_zirkler
  • statistic::T — test statistic
  • pvalue::T — p-value
  • df::Int — degrees of freedom (for chi-squared tests)
  • n_vars::Int — number of variables
  • n_obs::Int — number of observations
  • components::Union{Nothing, Vector{T}} — per-component statistics (for component-wise tests)
  • component_pvalues::Union{Nothing, Vector{T}} — per-component p-values
source
MacroEconometricModels.NormalityTestSuiteType
NormalityTestSuite{T}

Collection of normality test results from normality_test_suite.

Fields:

  • results::Vector{NormalityTestResult{T}} — individual test results
  • residuals::Matrix{T} — the residual matrix tested
  • n_vars::Int
  • n_obs::Int
source
MacroEconometricModels.ICASVARResultType
ICASVARResult{T} <: AbstractNonGaussianSVAR

Result from ICA-based SVAR identification.

Fields:

  • B0::Matrix{T} — structural impact matrix (n × n): ut = B₀ εt
  • W::Matrix{T} — unmixing matrix (n × n): εt = W ut
  • Q::Matrix{T} — rotation matrix for compute_Q integration
  • shocks::Matrix{T} — recovered structural shocks (T_eff × n)
  • method::Symbol:fastica, :jade, :sobi, :dcov, :hsic
  • converged::Bool
  • iterations::Int
  • objective::T — final objective value
source
MacroEconometricModels.NonGaussianMLResultType
NonGaussianMLResult{T} <: AbstractNonGaussianSVAR

Result from non-Gaussian maximum likelihood SVAR identification.

Fields:

  • B0::Matrix{T} — structural impact matrix (n × n)
  • Q::Matrix{T} — rotation matrix
  • shocks::Matrix{T} — structural shocks (T_eff × n)
  • distribution::Symbol:student_t, :mixture_normal, :pml, :skew_normal
  • loglik::T — log-likelihood at MLE
  • loglik_gaussian::T — Gaussian log-likelihood (for LR test)
  • dist_params::Dict{Symbol, Any} — distribution parameters
  • vcov::Matrix{T} — asymptotic covariance of B₀ elements
  • se::Matrix{T} — standard errors for B₀
  • converged::Bool
  • iterations::Int
  • aic::T
  • bic::T
source
MacroEconometricModels.MarkovSwitchingSVARResultType
MarkovSwitchingSVARResult{T} <: AbstractNonGaussianSVAR

Result from Markov-switching heteroskedasticity SVAR identification.

Fields:

  • B0::Matrix{T} — structural impact matrix
  • Q::Matrix{T} — rotation matrix
  • Sigma_regimes::Vector{Matrix{T}} — covariance per regime
  • Lambda::Vector{Vector{T}} — relative variances per regime
  • regime_probs::Matrix{T} — smoothed regime probabilities (T × K)
  • transition_matrix::Matrix{T} — Markov transition probabilities (K × K)
  • loglik::T
  • converged::Bool
  • iterations::Int
  • n_regimes::Int
source
MacroEconometricModels.GARCHSVARResultType
GARCHSVARResult{T} <: AbstractNonGaussianSVAR

Result from GARCH-based SVAR identification.

Fields:

  • B0::Matrix{T} — structural impact matrix
  • Q::Matrix{T} — rotation matrix
  • garch_params::Matrix{T} — (n × 3): [ω, α, β] per shock
  • cond_var::Matrix{T} — (T_eff × n) conditional variances
  • shocks::Matrix{T} — structural shocks
  • loglik::T
  • converged::Bool
  • iterations::Int
source
MacroEconometricModels.SmoothTransitionSVARResultType
SmoothTransitionSVARResult{T} <: AbstractNonGaussianSVAR

Result from smooth-transition heteroskedasticity SVAR identification.

Fields:

  • B0::Matrix{T} — structural impact matrix
  • Q::Matrix{T} — rotation matrix
  • Sigma_regimes::Vector{Matrix{T}} — covariance matrices for extreme regimes
  • Lambda::Vector{Vector{T}} — relative variances per regime
  • gamma::T — transition speed parameter
  • threshold::T — transition location parameter
  • transition_var::Vector{T} — transition variable values
  • G_values::Vector{T} — transition function G(s_t) values
  • loglik::T
  • converged::Bool
  • iterations::Int
source
MacroEconometricModels.ExternalVolatilitySVARResultType
ExternalVolatilitySVARResult{T} <: AbstractNonGaussianSVAR

Result from external volatility instrument SVAR identification.

Fields:

  • B0::Matrix{T} — structural impact matrix
  • Q::Matrix{T} — rotation matrix
  • Sigma_regimes::Vector{Matrix{T}} — covariance per regime
  • Lambda::Vector{Vector{T}} — relative variances per regime
  • regime_indices::Vector{Vector{Int}} — observation indices per regime
  • loglik::T
source
MacroEconometricModels.IdentifiabilityTestResultType
IdentifiabilityTestResult{T}

Result from an identifiability or specification test.

Fields:

  • test_name::Symbol — test identifier
  • statistic::T — test statistic
  • pvalue::T — p-value
  • identified::Bool — whether identification appears to hold
  • details::Dict{Symbol, Any} — method-specific details
source

Plotting Types

MacroEconometricModels.PlotOutputType
PlotOutput

Self-contained HTML document with inline D3.js visualization.

Fields

  • html::String: Complete HTML document string

Usage

p = plot_result(irf_result)
save_plot(p, "irf.html")       # save to file
display_plot(p)                 # open in browser
source

Type Hierarchy

AbstractMacroData
├── TimeSeriesData{T}
├── PanelData{T}
└── CrossSectionData{T}

DataDiagnostic
DataSummary
Frequency (enum: Daily, Monthly, Quarterly, Yearly, Mixed, Other)

AbstractARIMAModel <: StatsAPI.RegressionModel
├── ARModel{T}
├── MAModel{T}
├── ARMAModel{T}
└── ARIMAModel{T}

AbstractVARModel
├── VARModel{T}
└── VECMModel{T}

VECMForecast{T}
VECMGrangerResult{T}

PVARModel{T} <: StatsAPI.RegressionModel
PVARStability{T}
PVARTestResult{T} <: StatsAPI.HypothesisTest

DIDResult{T} <: AbstractFrequentistResult
EventStudyLP{T}
BaconDecomposition{T}
PretrendTestResult{T}
NegativeWeightResult{T}
HonestDiDResult{T}

AbstractAnalysisResult
├── AbstractFrequentistResult
│     ├── ImpulseResponse{T}, FEVD{T}, HistoricalDecomposition{T}
└── AbstractBayesianResult
      ├── BayesianImpulseResponse{T}, BayesianFEVD{T}, BayesianHistoricalDecomposition{T}

AbstractImpulseResponse
├── ImpulseResponse{T}
├── BayesianImpulseResponse{T}
└── AbstractLPImpulseResponse
    └── LPImpulseResponse{T}

AbstractFEVD
├── FEVD{T}
├── BayesianFEVD{T}
└── LPFEVD{T}

AbstractHistoricalDecomposition
├── HistoricalDecomposition{T}
└── BayesianHistoricalDecomposition{T}

AbstractFactorModel
├── FactorModel{T}
├── DynamicFactorModel{T}
└── GeneralizedDynamicFactorModel{T}

FactorForecast{T}

AbstractLPModel
├── LPModel{T}
├── LPIVModel{T}
├── SmoothLPModel{T}
├── StateLPModel{T}
└── PropensityLPModel{T}

StructuralLP{T}
LPForecast{T}

AbstractCovarianceEstimator
├── NeweyWestEstimator{T}
├── WhiteEstimator
└── DriscollKraayEstimator{T}

AbstractGMMModel
└── GMMModel{T}

AbstractPrior
└── MinnesotaHyperparameters{T}

BVARPosterior{T}

AbstractUnitRootTest <: StatsAPI.HypothesisTest
├── ADFResult{T}
├── KPSSResult{T}
├── PPResult{T}
├── ZAResult{T}
├── NgPerronResult{T}
└── JohansenResult{T}

VARStationarityResult{T}

LRTestResult{T} <: StatsAPI.HypothesisTest
LMTestResult{T} <: StatsAPI.HypothesisTest
GrangerCausalityResult{T} <: StatsAPI.HypothesisTest

AbstractNormalityTest <: StatsAPI.HypothesisTest
└── NormalityTestResult{T}

NormalityTestSuite{T}

AbstractNonGaussianSVAR
├── ICASVARResult{T}
├── NonGaussianMLResult{T}
├── MarkovSwitchingSVARResult{T}
├── GARCHSVARResult{T}
├── SmoothTransitionSVARResult{T}
└── ExternalVolatilitySVARResult{T}

IdentifiabilityTestResult{T}

AbstractVolatilityModel <: StatsAPI.RegressionModel
├── ARCHModel{T}
├── GARCHModel{T}
├── EGARCHModel{T}
├── GJRGARCHModel{T}
└── SVModel{T}

VolatilityForecast{T}

AbstractNowcastModel
├── NowcastDFM{T}
├── NowcastBVAR{T}
└── NowcastBridge{T}

NowcastResult{T}
NowcastNews{T}

DSGESpec{T}
LinearDSGE{T}
DSGESolution{T}
PerfectForesightPath{T}

AbstractDSGEModel
└── DSGEEstimation{T}

OccBinConstraint{T}
OccBinRegime{T}
OccBinSolution{T}
OccBinIRF{T}

StatsAPI.RegressionModel
├── RegModel{T} (OLS/WLS/IV)
├── LogitModel{T} (Binary logit MLE)
└── ProbitModel{T} (Binary probit MLE)

MarginalEffects{T}

DSGE Models

MacroEconometricModels.DSGESpecType
DSGESpec{T}

Parsed DSGE model specification. Created by the @dsge macro.

Fields:

  • endog::Vector{Symbol} — endogenous variable names (possibly augmented)
  • exog::Vector{Symbol} — exogenous shock names
  • params::Vector{Symbol} — parameter names
  • param_values::Dict{Symbol,T} — calibrated parameter values
  • equations::Vector{Expr} — raw Julia equation expressions (possibly augmented)
  • residual_fns::Vector{Function} — callable f(y_t, y_lag, y_lead, ε, θ) → scalar
  • n_endog::Int — number of endogenous variables (including auxiliaries)
  • n_exog::Int — number of exogenous shocks
  • n_params::Int — number of parameters
  • n_expect::Int — number of expectation errors (forward-looking variables)
  • forward_indices::Vector{Int} — indices of equations with [t+1] terms
  • steady_state::Vector{T} — steady state values
  • varnames::Vector{String} — display names
  • ss_fn::Union{Nothing, Function} — optional analytical steady-state function θ → y_ss
  • original_endog::Vector{Symbol} — pre-augmentation endogenous variable names
  • original_equations::Vector{Expr} — pre-augmentation equation expressions
  • n_original_endog::Int — number of original endogenous variables
  • n_original_eq::Int — number of original equations
  • augmented::Bool — whether model was augmented with auxiliary variables
  • max_lag::Int — maximum lag order in the model (1 for standard, >1 if augmented)
  • max_lead::Int — maximum lead order in the model (1 for standard, >1 if augmented)
source
MacroEconometricModels.LinearDSGEType
LinearDSGE{T}

Linearized DSGE in Sims canonical form: Γ₀·y_t = Γ₁·y_{t-1} + C + Ψ·ε_t + Π·η_t.

Fields:

  • Gamma0::Matrix{T} — n × n coefficient on y_t
  • Gamma1::Matrix{T} — n × n coefficient on y_{t-1}
  • C::Vector{T} — n × 1 constants
  • Psi::Matrix{T} — n × n_shocks shock loading
  • Pi::Matrix{T} — n × n_expect expectation error selection
  • spec::DSGESpec{T} — back-reference to specification
source
MacroEconometricModels.DSGESolutionType
DSGESolution{T}

Rational expectations solution: y_t = G1·y_{t-1} + impact·ε_t + C_sol.

Fields:

  • G1::Matrix{T} — n × n state transition matrix
  • impact::Matrix{T} — n × n_shocks impact matrix
  • C_sol::Vector{T} — n × 1 constants
  • eu::Vector{Int} — [existence, uniqueness]: 1=yes, 0=no, -1=indeterminate
  • method::Symbol:gensys or :blanchard_kahn
  • eigenvalues::Vector{ComplexF64} — generalized eigenvalues from QZ
  • spec::DSGESpec{T} — model specification
  • linear::LinearDSGE{T} — linearized form
source
MacroEconometricModels.PerturbationSolutionType
PerturbationSolution{T}

Higher-order perturbation solution with Kim et al. (2008) pruning.

For order k, the decision rule is:

  • Order 1: z_t = z̄ + g_x·x̂_t
  • Order 2: + (1/2)·g_xx·(x̂_t ⊗ x̂_t) + (1/2)·g_σσ·σ²
  • Order 3: + (1/6)·g_xxx·(x̂_t ⊗ x̂_t ⊗ x̂_t) + (3/6)·g_σσx·σ²·x̂_t

Fields:

  • order — perturbation order (1, 2, or 3)
  • gx, hx — first-order coefficients (controls: ny×nv, states: nx×nv)
  • gxx, hxx, gσσ, hσσ — second-order (nothing if order < 2)
  • gxxx, hxxx, gσσx, hσσx, gσσσ, hσσσ — third-order (nothing if order < 3)
  • eta — shock loading matrix (nv × nu)
  • steady_state — full steady state vector
  • state_indices, control_indices — variable partition
  • eu — [existence, uniqueness] from first-order
  • method:perturbation
  • spec — model specification
  • linear — linearized form
source
MacroEconometricModels.ProjectionSolutionType
ProjectionSolution{T}

Global policy function approximation via Chebyshev collocation.

The policy function is y = Σ_k coefficients[k] * T_k(x_scaled) where T_k are Chebyshev polynomials evaluated at states mapped to [-1,1].

Fields:

  • coefficientsn_vars × n_basis Chebyshev coefficients
  • state_boundsnx × 2 domain bounds [lower upper] per state
  • grid_type:tensor or :smolyak
  • degree — polynomial degree (tensor) or Smolyak level μ
  • collocation_nodesn_nodes × nx grid points
  • residual_norm — final ||R||
  • n_basis — number of basis functions
  • multi_indicesn_basis × nx multi-index matrix
  • quadrature:gauss_hermite or :monomial
  • spec — model specification
  • linear — linearized form
  • steady_state — cached steady state vector
  • state_indices, control_indices — variable partition
  • converged — Newton convergence flag
  • iterations — Newton iterations used
  • method:projection
source
MacroEconometricModels.PerfectForesightPathType
PerfectForesightPath{T}

Deterministic perfect foresight path.

Fields:

  • path::Matrix{T} — Tperiods × nendog level values
  • deviations::Matrix{T} — Tperiods × nendog deviations from SS
  • converged::Bool — Newton convergence flag
  • iterations::Int — Newton iterations used
  • spec::DSGESpec{T} — model specification
source
MacroEconometricModels.DSGEEstimationType
DSGEEstimation{T} <: AbstractDSGEModel

DSGE model estimated via GMM (IRF matching or Euler equation moments).

Fields:

  • theta::Vector{T} — estimated deep parameters
  • vcov::Matrix{T} — asymptotic covariance matrix
  • param_names::Vector{Symbol} — names of estimated parameters
  • method::Symbol:irf_matching or :euler_gmm
  • J_stat::T — Hansen J-test statistic
  • J_pvalue::T — J-test p-value
  • solution::Union{DSGESolution{T}, PerturbationSolution{T}} — solution at estimated parameters
  • converged::Bool — optimization convergence
  • spec::DSGESpec{T} — model specification
source
MacroEconometricModels.BayesianDSGEType
BayesianDSGE{T} <: AbstractDSGEModel

Bayesian DSGE estimation result container.

Fields:

  • theta_draws::Matrix{T} — ndraws x nparams posterior draws
  • log_posterior::Vector{T} — log posterior at each draw
  • param_names::Vector{Symbol} — parameter names
  • priors::DSGEPrior{T} — prior specification
  • log_marginal_likelihood::T — log marginal likelihood (model evidence)
  • method::Symbol — estimation method (:smc, :rwmh, :csmc, etc.)
  • acceptance_rate::T — MCMC acceptance rate
  • ess_history::Vector{T} — ESS history (SMC) or empty (MCMC)
  • phi_schedule::Vector{T} — tempering schedule (SMC) or empty (MCMC)
  • spec::DSGESpec{T} — model specification
  • solution::Union{DSGESolution{T}, PerturbationSolution{T}} — solution at posterior mode
  • state_space::Union{DSGEStateSpace{T}, NonlinearStateSpace{T}} — state space at posterior mode
source
MacroEconometricModels.BayesianDSGESimulationType
BayesianDSGESimulation{T}

Posterior predictive simulation result with pointwise quantile bands.

Fields:

  • quantiles::Array{T,3} — Tperiods x nvars x n_quantiles
  • point_estimate::Matrix{T} — Tperiods x nvars (posterior median)
  • T_periods::Int — number of simulation periods
  • variables::Vector{String} — variable names
  • quantile_levels::Vector{T} — quantile levels (e.g. [0.05, 0.16, 0.84, 0.95])
  • all_paths::Array{T,3} — ndraws x Tperiods x n_vars (raw draws)
source
MacroEconometricModels.VariableBoundType
VariableBound{T} <: DSGEConstraint{T}

Box constraint on an endogenous variable: lower <= var <= upper.

Fields

  • var_name::Symbol — endogenous variable name (must exist in spec.endog)
  • lower::Union{T, Nothing} — lower bound (nothing = unbounded below)
  • upper::Union{T, Nothing} — upper bound (nothing = unbounded above)
source
MacroEconometricModels.NonlinearConstraintType
NonlinearConstraint{T} <: DSGEConstraint{T}

Nonlinear inequality constraint: fn(y, y_lag, y_lead, e, theta) <= 0.

The function signature matches @dsge residual functions. For steady state: evaluated with y_lag = y_lead = y, e = 0. For perfect foresight: evaluated at each period t.

Fields

  • fn::Function(y, y_lag, y_lead, e, theta) -> scalar (must be <= 0 when satisfied)
  • label::String — display label for diagnostics
source
MacroEconometricModels.ParameterTransformType
ParameterTransform{T<:AbstractFloat}

Bijective parameter transform specification for constrained optimization.

Transform rules per element:

  • (-Inf, Inf) → identity
  • (0, Inf) → exp/log
  • (-Inf, 0) → -exp/-log
  • (a, b) → logistic: a + (b-a) / (1 + exp(-x))

Fields

  • lower::Vector{T} — lower bounds (-Inf = unbounded below)
  • upper::Vector{T} — upper bounds (Inf = unbounded above)
source
MacroEconometricModels.OccBinConstraintType
OccBinConstraint{T}

A single occasionally binding constraint for OccBin piecewise-linear solution.

Fields:

  • expr::Expr — full constraint expression (e.g., :(R >= 0))
  • variable::Symbol — constrained variable name
  • bound::T — constraint bound value
  • direction::Symbol:geq or :leq
  • bind_expr::Expr — expression substituted when the constraint binds
source
MacroEconometricModels.OccBinRegimeType
OccBinRegime{T}

Linearized coefficient matrices for one regime (binding or slack).

Fields:

  • A::Matrix{T} — coefficient on y[t+1] (expectation terms)
  • B::Matrix{T} — coefficient on y[t] (contemporaneous terms)
  • C::Matrix{T} — coefficient on y[t-1] (lagged terms)
  • D::Matrix{T} — coefficient on ε[t] (shock impact)
source
MacroEconometricModels.OccBinSolutionType
OccBinSolution{T}

Piecewise-linear solution from the OccBin algorithm (Guerrieri & Iacoviello 2015).

Fields:

  • linear_path::Matrix{T} — Tperiods × nendog unconstrained linear path
  • piecewise_path::Matrix{T} — Tperiods × nendog piecewise-linear path
  • steady_state::Vector{T} — steady state values
  • regime_history::Matrix{Int} — Tperiods × nconstraints regime indicators (0 = slack, 1+ = binding)
  • converged::Bool — convergence flag
  • iterations::Int — number of guess-and-verify iterations
  • spec::DSGESpec{T} — model specification
  • varnames::Vector{String} — variable display names
  • constraints::Vector{OccBinConstraint{T}} — constraint(s) used in the solve
source
MacroEconometricModels.OccBinIRFType
OccBinIRF{T}

Impulse response comparison between unconstrained linear and OccBin piecewise-linear paths.

Fields:

  • linear::Matrix{T} — H × n_endog linear IRF
  • piecewise::Matrix{T} — H × n_endog piecewise-linear IRF
  • regime_history::Matrix{Int} — H × n_constraints regime indicators
  • varnames::Vector{String} — variable display names
  • shock_name::String — name of the shocked variable
source

Panel Regression Models

MacroEconometricModels.PanelRegModelType
PanelRegModel{T} <: StatsAPI.RegressionModel

Linear panel regression model estimated via Fixed Effects (FE), Random Effects (RE), First-Difference (FD), Between, or Correlated Random Effects (CRE).

Fields

  • beta::Vector{T} — estimated coefficients
  • vcov_mat::Matrix{T} — variance-covariance matrix of coefficients
  • residuals::Vector{T} — residuals
  • fitted::Vector{T} — fitted values
  • y::Vector{T} — dependent variable
  • X::Matrix{T} — regressor matrix
  • r2_within::T — within R-squared
  • r2_between::T — between R-squared
  • r2_overall::T — overall R-squared
  • sigma_u::T — between-group standard deviation
  • sigma_e::T — within-group standard deviation
  • rho::T — fraction of variance due to ui: sigmau^2 / (sigmau^2 + sigmae^2)
  • theta::Union{Nothing,T} — quasi-demeaning parameter (RE only)
  • f_stat::T — F-statistic for joint significance
  • f_pval::T — p-value of the F-test
  • loglik::T — log-likelihood
  • aic::T — Akaike information criterion
  • bic::T — Bayesian information criterion
  • varnames::Vector{String} — coefficient names
  • method::Symbol — :fe, :re, :fd, :between, :cre
  • twoway::Bool — whether time fixed effects are included
  • cov_type::Symbol — covariance estimator (:ols, :robust, :cluster, :driscoll_kraay)
  • n_obs::Int — number of observations
  • n_groups::Int — number of groups
  • n_periods_avg::T — average number of periods per group
  • group_effects::Union{Nothing,Vector{T}} — estimated group effects (FE only)
  • data::PanelData{T} — original panel data

References

  • Baltagi, B. H. (2021). Econometric Analysis of Panel Data. 6th ed. Springer.
  • Wooldridge, J. M. (2010). Econometric Analysis of Cross Section and Panel Data. 2nd ed. MIT Press.
source
MacroEconometricModels.PanelIVModelType
PanelIVModel{T} <: StatsAPI.RegressionModel

Panel instrumental-variables regression model (FE-IV, RE-IV, FD-IV, Hausman-Taylor).

Fields

  • beta::Vector{T} — estimated coefficients
  • vcov_mat::Matrix{T} — variance-covariance matrix
  • residuals::Vector{T} — residuals
  • fitted::Vector{T} — fitted values
  • y::Vector{T} — dependent variable
  • X::Matrix{T} — regressor matrix
  • Z::Matrix{T} — instrument matrix
  • r2_within::T — within R-squared
  • r2_between::T — between R-squared
  • r2_overall::T — overall R-squared
  • sigma_u::T — between-group standard deviation
  • sigma_e::T — within-group standard deviation
  • rho::T — fraction of variance due to u_i
  • first_stage_f::T — first-stage F-statistic
  • sargan_stat::Union{Nothing,T} — Sargan overidentification statistic
  • sargan_pval::Union{Nothing,T} — Sargan test p-value
  • varnames::Vector{String} — coefficient names
  • endog_names::Vector{String} — endogenous variable names
  • instrument_names::Vector{String} — instrument names
  • method::Symbol — :feiv, :reiv, :fdiv, :hausmantaylor
  • cov_type::Symbol — covariance estimator
  • n_obs::Int — number of observations
  • n_groups::Int — number of groups
  • data::PanelData{T} — original panel data

References

  • Baltagi, B. H. (2021). Econometric Analysis of Panel Data. 6th ed. Springer.
  • Hausman, J. A. & Taylor, W. E. (1981). Econometrica 49(6), 1377-1398.
source
MacroEconometricModels.PanelLogitModelType
PanelLogitModel{T} <: StatsAPI.RegressionModel

Panel logistic regression model (pooled, FE conditional, RE, CRE).

Fields

  • beta::Vector{T} — estimated coefficients
  • vcov_mat::Matrix{T} — variance-covariance matrix
  • y::Vector{T} — binary dependent variable (0/1)
  • X::Matrix{T} — regressor matrix
  • fitted::Vector{T} — predicted probabilities
  • loglik::T — maximized log-likelihood
  • loglik_null::T — null model log-likelihood
  • pseudo_r2::T — McFadden's pseudo R-squared
  • aic::T — Akaike information criterion
  • bic::T — Bayesian information criterion
  • sigma_u::Union{Nothing,T} — RE standard deviation (nothing for FE/pooled)
  • rho::Union{Nothing,T} — fraction of variance due to u_i (RE only)
  • varnames::Vector{String} — coefficient names
  • method::Symbol — :pooled, :fe, :re, :cre
  • cov_type::Symbol — covariance estimator
  • converged::Bool — whether optimization converged
  • iterations::Int — number of iterations
  • n_obs::Int — number of observations
  • n_groups::Int — number of groups
  • data::PanelData{T} — original panel data

References

  • Chamberlain, G. (1980). Review of Economic Studies 47(1), 225-238.
  • Wooldridge, J. M. (2010). Econometric Analysis of Cross Section and Panel Data. 2nd ed. MIT Press.
source
MacroEconometricModels.PanelProbitModelType
PanelProbitModel{T} <: StatsAPI.RegressionModel

Panel probit regression model (pooled, FE conditional, RE, CRE). Identical structure to PanelLogitModel{T}, using the standard normal CDF link.

References

  • Wooldridge, J. M. (2010). Econometric Analysis of Cross Section and Panel Data. 2nd ed. MIT Press.
source

Ordered and Multinomial Models

MacroEconometricModels.OrderedLogitModelType
OrderedLogitModel{T} <: StatsAPI.RegressionModel

Ordered logistic regression model estimated via maximum likelihood.

Fields

  • y::Vector{Int} – dependent variable (remapped to 1:J)
  • X::Matrix{T} – regressor matrix (no intercept)
  • beta::Vector{T} – slope coefficients (K)
  • cutpoints::Vector{T} – cutpoints/thresholds (J-1)
  • vcov_mat::Matrix{T} – joint vcov of beta; cutpoints
  • fitted::Matrix{T} – predicted probabilities (n x J)
  • loglik::T – maximized log-likelihood
  • loglik_null::T – null model log-likelihood (cutpoints only)
  • pseudo_r2::T – McFadden's pseudo R-squared
  • aic::T – Akaike information criterion
  • bic::T – Bayesian information criterion
  • varnames::Vector{String} – coefficient names
  • categories::Vector – original category values
  • converged::Bool – whether optimization converged
  • iterations::Int – number of iterations performed
  • cov_type::Symbol – covariance estimator

References

  • McCullagh, P. (1980). JRSS B 42(2), 109-142.
  • Agresti, A. (2010). Analysis of Ordinal Categorical Data. 2nd ed. Wiley.
source
MacroEconometricModels.OrderedProbitModelType
OrderedProbitModel{T} <: StatsAPI.RegressionModel

Ordered probit regression model estimated via maximum likelihood.

Same fields as OrderedLogitModel{T}, using the standard normal CDF as the link function.

References

  • McCullagh, P. (1980). JRSS B 42(2), 109-142.
  • Wooldridge, J. M. (2010). Econometric Analysis of Cross Section and Panel Data. 2nd ed. MIT Press.
source
MacroEconometricModels.MultinomialLogitModelType
MultinomialLogitModel{T} <: StatsAPI.RegressionModel

Multinomial logistic regression model estimated via maximum likelihood.

Fields

  • y::Vector{Int} – dependent variable (remapped to 1:J)
  • X::Matrix{T} – regressor matrix (n x K, with intercept if desired)
  • beta::Matrix{T} – coefficient matrix (K x (J-1)), base category = 1
  • vcov_mat::Matrix{T} – vcov of vec(beta), K(J-1) x K(J-1)
  • fitted::Matrix{T} – predicted probabilities (n x J)
  • loglik::T – maximized log-likelihood
  • loglik_null::T – null model log-likelihood: n * log(1/J)
  • pseudo_r2::T – McFadden's pseudo R-squared
  • aic::T – Akaike information criterion
  • bic::T – Bayesian information criterion
  • varnames::Vector{String} – coefficient names
  • categories::Vector – original category values
  • converged::Bool – whether optimization converged
  • iterations::Int – number of iterations performed
  • cov_type::Symbol – covariance estimator

References

  • McFadden, D. (1974). Conditional logit analysis of qualitative choice behavior. In P. Zarembka (Ed.), Frontiers in Econometrics (pp. 105-142). Academic Press.
  • Train, K. E. (2009). Discrete Choice Methods with Simulation. 2nd ed. Cambridge Univ. Press.
source

FAVAR Models

MacroEconometricModels.FAVARModelType
FAVARModel{T} <: AbstractVARModel

Factor-Augmented VAR model (Bernanke, Boivin & Eliasz, 2005).

The FAVAR system estimates a VAR on [Ft, Ykey,t] where Ft are latent factors extracted from a large panel X, and Ykey are observed key variables (e.g., the federal funds rate).

Fields

  • Y::Matrix{T}: Augmented data [F, Ykey] used in VAR (Teff × (r+n_key))
  • p::Int: VAR lag order
  • B::Matrix{T}: VAR coefficient matrix ((1+p*(r+nkey)) × (r+nkey))
  • U::Matrix{T}: VAR residuals
  • Sigma::Matrix{T}: Residual covariance
  • varnames::Vector{String}: Variable names in VAR (["F1","F2",...,"Y1","Y2",...])
  • X_panel::Matrix{T}: Original panel data (T_obs × N)
  • panel_varnames::Vector{String}: Panel variable names (length N)
  • Y_key_indices::Vector{Int}: Column indices of key variables in X_panel
  • n_factors::Int: Number of latent factors r
  • n_key::Int: Number of key observed variables
  • factors::Matrix{T}: Extracted factors (T_obs × r)
  • loadings::Matrix{T}: Factor loadings (N × r)
  • factor_model::FactorModel{T}: Underlying factor model from PCA
  • aic::T: Akaike information criterion
  • bic::T: Bayesian information criterion
  • loglik::T: Log-likelihood
source
MacroEconometricModels.BayesianFAVARType
BayesianFAVAR{T}

Bayesian FAVAR with posterior draws of coefficients, covariances, factors, and loadings.

Fields

  • B_draws::Array{T,3}: Coefficient draws (ndraws × k × nvar)
  • Sigma_draws::Array{T,3}: Covariance draws (ndraws × nvar × n_var)
  • factor_draws::Array{T,3}: Factor draws (ndraws × Tobs × r)
  • loadings_draws::Array{T,3}: Loading draws (n_draws × N × r)
  • X_panel::Matrix{T}: Original panel data (T_obs × N)
  • panel_varnames::Vector{String}: Panel variable names
  • Y_key_indices::Vector{Int}: Key variable column indices
  • n_factors::Int: Number of factors
  • n_key::Int: Number of key variables
  • n::Int: Total VAR variables (r + n_key)
  • p::Int: VAR lag order
  • data::Matrix{T}: Augmented VAR data [F, Y_key]
  • varnames::Vector{String}: VAR variable names
source

Structural DFM

MacroEconometricModels.StructuralDFMType
StructuralDFM{T} <: AbstractFactorModel

Structural Dynamic Factor Model combining GDFM with structural identification.

Fields

  • gdfm::GeneralizedDynamicFactorModel{T}: Underlying GDFM estimation
  • factor_var::VARModel{T}: VAR(p) fitted on q common factors
  • B0::Matrix{T}: Impact matrix (q x q), B0 = chol(Sigma) * Q
  • Q::Matrix{T}: Rotation/identification matrix (q x q)
  • identification::Symbol: Identification method (:cholesky or :sign)
  • structural_irf::Array{T,3}: Panel-wide structural IRFs (H x N x q)
  • loadings_td::Matrix{T}: Time-domain loadings (N x q), Lambda = (F'F)^{-1} F' X
  • p_var::Int: VAR lag order on factors
  • shock_names::Vector{String}: Names for structural shocks
source

Spectral Analysis Types

MacroEconometricModels.SpectralDensityResultType
SpectralDensityResult{T} <: AbstractAnalysisResult

Result from spectral density estimation (periodogram, Welch, smoothed, AR).

Fields

  • freq::Vector{T} — frequency grid [0, π]
  • density::Vector{T} — estimated spectral density
  • ci_lower::Vector{T} — lower confidence bound
  • ci_upper::Vector{T} — upper confidence bound
  • method::Symbol — estimation method (:periodogram, :welch, :smoothed, :ar)
  • bandwidth::T — effective bandwidth
  • nobs::Int — number of observations
source
MacroEconometricModels.CrossSpectrumResultType
CrossSpectrumResult{T} <: AbstractAnalysisResult

Result from cross-spectral analysis between two series.

Fields

  • freq::Vector{T} — frequency grid [0, π]
  • co_spectrum::Vector{T} — co-spectrum (real part of cross-spectral density)
  • quad_spectrum::Vector{T} — quadrature spectrum (negative imaginary part)
  • coherence::Vector{T} — squared coherence ∈ [0, 1]
  • phase::Vector{T} — phase spectrum (radians)
  • gain::Vector{T} — gain (amplitude ratio)
  • nobs::Int — number of observations
source
MacroEconometricModels.TransferFunctionResultType
TransferFunctionResult{T} <: AbstractAnalysisResult

Result from transfer function (frequency response) analysis of a filter.

Fields

  • freq::Vector{T} — frequency grid [0, π]
  • gain::Vector{T} — gain (amplitude) at each frequency
  • phase::Vector{T} — phase shift (radians) at each frequency
  • filter::Symbol — filter type (:hp, :bk, :hamilton, :ideal_bandpass)
source
MacroEconometricModels.ACFResultType
ACFResult{T} <: AbstractAnalysisResult

Result from autocorrelation, partial autocorrelation, or cross-correlation analysis.

Fields

  • lags::Vector{Int} — lag indices
  • acf::Vector{T} — autocorrelation values
  • pacf::Vector{T} — partial autocorrelation values
  • ci::T — confidence interval half-width (±1.96/√n by default)
  • ccf::Union{Nothing,Vector{T}} — cross-correlation values (for ccf())
  • q_stats::Vector{T} — cumulative Ljung-Box Q-statistics
  • q_pvalues::Vector{T} — p-values of Q-statistics
  • nobs::Int — number of observations
source

Portmanteau Test Types

MacroEconometricModels.LjungBoxResultType
LjungBoxResult{T} <: StatsAPI.HypothesisTest

Result from the Ljung-Box Q test for serial correlation.

Fields

  • statistic::T — Q-statistic
  • pvalue::T — p-value (χ² distribution)
  • df::Int — degrees of freedom
  • lags::Int — number of lags tested
  • nobs::Int — number of observations
source
MacroEconometricModels.BoxPierceResultType
BoxPierceResult{T} <: StatsAPI.HypothesisTest

Result from the Box-Pierce Q test for serial correlation.

Fields

  • statistic::T — Q₀-statistic
  • pvalue::T — p-value (χ² distribution)
  • df::Int — degrees of freedom
  • lags::Int — number of lags tested
  • nobs::Int — number of observations
source
MacroEconometricModels.DurbinWatsonResultType
DurbinWatsonResult{T} <: StatsAPI.HypothesisTest

Result from the Durbin-Watson test for first-order serial correlation.

Fields

  • statistic::T — DW statistic ∈ [0, 4]
  • pvalue::T — approximate p-value
  • nobs::Int — number of observations
source
MacroEconometricModels.BartlettWhiteNoiseResultType
BartlettWhiteNoiseResult{T} <: StatsAPI.HypothesisTest

Result from Bartlett's cumulative periodogram test for white noise.

Fields

  • statistic::T — Kolmogorov-Smirnov statistic (max deviation from uniform)
  • pvalue::T — approximate p-value
  • nobs::Int — number of observations
source
MacroEconometricModels.FisherTestResultType
FisherTestResult{T} <: StatsAPI.HypothesisTest

Result from Fisher's test for periodicity (hidden periodicities in data).

Fields

  • statistic::T — Fisher's g statistic (max periodogram / sum)
  • pvalue::T — p-value
  • peak_freq::T — frequency with maximum periodogram value
  • nobs::Int — number of observations
source

Advanced Test Types

MacroEconometricModels.DFGLSResultType
DFGLSResult{T} <: AbstractUnitRootTest

DF-GLS unit root test result (Elliott, Rothenberg & Stock 1996). Also reports ERS Pt statistic and Ng-Perron MGLS statistics.

source
MacroEconometricModels.AndrewsResultType
AndrewsResult{T} <: AbstractUnitRootTest

Andrews (1993) / Andrews-Ploberger (1994) structural break test result.

Tests for a single unknown structural break point in a linear regression by computing sup-Wald, exp-Wald, or mean-Wald statistics over a trimmed range of candidate break dates.

Fields:

  • statistic: Test statistic (sup-Wald, exp-Wald, or mean-Wald)
  • pvalue: Approximate p-value from Hansen (1997) critical values
  • break_index: Index of estimated break date (for sup-Wald)
  • break_fraction: Break date as fraction of sample
  • test_type: Type of test (:supwald, :expwald, :meanwald)
  • critical_values: Critical values at 1%, 5%, 10% levels
  • stat_sequence: Full sequence of Wald statistics across candidate breaks
  • trimming: Trimming fraction (e.g., 0.15)
  • nobs: Number of observations
  • n_params: Number of parameters tested for instability
source
MacroEconometricModels.BaiPerronResultType
BaiPerronResult{T} <: AbstractUnitRootTest

Bai-Perron (1998, 2003) multiple structural break test result.

Tests for multiple unknown structural break points using sequential and simultaneous procedures, with BIC/LWZ information criteria for break number selection.

Fields:

  • n_breaks: Estimated number of breaks
  • break_dates: Estimated break date indices
  • break_cis: Confidence intervals for break dates as (lower, upper) tuples
  • regime_coefs: Coefficient estimates for each regime
  • regime_ses: Standard errors for each regime
  • supf_stats: sup-F(l) statistics for l = 1, ..., max_breaks
  • supf_pvalues: P-values for sup-F tests
  • sequential_stats: Sequential sup-F(l+1|l) statistics
  • sequential_pvalues: P-values for sequential tests
  • bic_values: BIC for each number of breaks (0, 1, ..., max_breaks)
  • lwz_values: LWZ (modified Schwarz) for each number of breaks
  • trimming: Trimming fraction (e.g., 0.15)
  • nobs: Number of observations
source
MacroEconometricModels.FactorBreakResultType
FactorBreakResult{T} <: AbstractUnitRootTest

Structural break test for factor models.

Tests for structural instability in factor loadings or the number of factors, following Breitung-Eickmeier (2011) or Chen-Dolado-Gonzalo (2014).

Fields:

  • statistic: Test statistic
  • pvalue: P-value
  • break_date: Estimated break date index (nothing if no break detected)
  • method: Test method (:breitungeickmeier, :chendolado_gonzalo)
  • n_factors: Number of factors in the model
  • nobs: Time dimension (T)
  • n_vars: Number of observed variables
source
MacroEconometricModels.PANICResultType
PANICResult{T} <: AbstractUnitRootTest

Bai-Ng (2004, 2010) PANIC (Panel Analysis of Nonstationarity in Idiosyncratic and Common components) test result.

Decomposes panel data into common factors and idiosyncratic components via principal components, then tests each for unit roots separately.

Fields:

  • factor_adf_stats: ADF statistics for each estimated common factor
  • factor_adf_pvalues: P-values for factor ADF tests
  • pooled_statistic: Pooled test statistic for idiosyncratic components
  • pooled_pvalue: P-value for pooled test
  • individual_stats: Individual unit ADF statistics on defactored data
  • individual_pvalues: Individual unit p-values
  • n_factors: Number of common factors used
  • method: Pooling method (:pooled, :modified)
  • nobs: Time dimension (T)
  • n_units: Cross-section dimension (N)
source
MacroEconometricModels.PesaranCIPSResultType
PesaranCIPSResult{T} <: AbstractUnitRootTest

Pesaran (2007) CIPS (Cross-sectionally Augmented IPS) panel unit root test result.

Augments individual ADF regressions with cross-section averages to account for cross-sectional dependence. The CIPS statistic is the average of individual CADF statistics.

Fields:

  • cips_statistic: Cross-sectionally augmented IPS statistic (average of CADF)
  • pvalue: Approximate p-value from Pesaran (2007) critical value tables
  • individual_cadf_stats: CADF statistics for each cross-section unit
  • critical_values: Critical values at 1%, 5%, 10% levels
  • lags: Number of augmenting lags
  • deterministic: Deterministic specification (:none, :constant, :trend)
  • nobs: Time dimension (T)
  • n_units: Cross-section dimension (N)
source
MacroEconometricModels.MoonPerronResultType
MoonPerronResult{T} <: AbstractUnitRootTest

Moon-Perron (2004) panel unit root test result.

Uses factor-adjusted t-statistics for testing the unit root null in panels with cross-sectional dependence. Reports two test statistics (ta and tb) with different bias corrections.

Fields:

  • t_a_statistic: First modified t-statistic (t_a^*)
  • t_b_statistic: Second modified t-statistic (t_b^*)
  • pvalue_a: P-value for t_a^* (standard normal under H0)
  • pvalue_b: P-value for t_b^* (standard normal under H0)
  • n_factors: Number of common factors estimated
  • nobs: Time dimension (T)
  • n_units: Cross-section dimension (N)
source

LP-DiD Types

MacroEconometricModels.LPDiDResultType
LPDiDResult{T<:AbstractFloat}

LP-DiD estimation result with full Dube, Girardi, Jordà & Taylor (2025) specification.

Fields

Event Study

  • coefficients::Vector{T} — treatment effects β_h at each event-time
  • se::Vector{T} — standard errors
  • ci_lower::Vector{T} — lower CI bounds
  • ci_upper::Vector{T} — upper CI bounds
  • event_times::Vector{Int} — event-time grid
  • reference_period::Int — omitted period (typically -1)
  • nobs_per_horizon::Vector{Int} — effective observations per horizon

Pooled Estimates

  • pooled_post — NamedTuple (coef, se, cilower, ciupper, nobs) or nothing
  • pooled_pre — NamedTuple (coef, se, cilower, ciupper, nobs) or nothing

Regression Details

  • vcov::Vector{Matrix{T}} — VCV matrices per horizon

Metadata

  • outcome_var::String — outcome variable name
  • treatment_var::String — treatment variable name
  • T_obs::Int — total observations in panel
  • n_groups::Int — number of panel units
  • specification::Symbol — :absorbing, :nonabsorbing, or :oneoff
  • pmd::Union{Nothing,Symbol,Int} — PMD specification
  • reweight::Bool — whether IPW reweighting was used
  • nocomp::Bool — whether composition changes were ruled out
  • ylags::Int — number of outcome lags as controls
  • dylags::Int — number of ΔY lags as controls
  • pre_window::Int — pre-treatment event window
  • post_window::Int — post-treatment event window
  • cluster::Symbol — clustering level
  • conf_level::T — confidence level
  • data::PanelData{T} — original panel data

References

  • Dube, A., Girardi, D., Jordà, Ò. & Taylor, A.M. (2025). JAE.
  • Acemoglu, D. et al. (2019). JPE 127(1), 47-100.
source