Visualization#

The viz module provides publication-quality plots for robustness analysis results.

Co-Movement Plot (Figure 3.9)#

Creates a 3x2 grid showing cross-correlations at leads/lags (-4 to +4) for five variables: unemployment, productivity, price index, real interest rate, and real wage.

from validation.robustness import plot_comovements

plot_comovements(iv_result, output_dir="output/", show=True)

Impulse-Response Function Plot#

Compares baseline AR(2) IRF (dashed) with cross-simulation mean AR(1) IRF (solid).

from validation.robustness import plot_irf

plot_irf(iv_result, show=True)

Sensitivity Co-Movement Comparison#

Shows how co-movement structure changes across parameter values for each experiment.

from validation.robustness import plot_sensitivity_comovements

for exp_result in sa.experiments.values():
    plot_sensitivity_comovements(exp_result, show=True)

PA Experiment Plots#

GDP comparison (Figure 3.10): Side-by-side time series of GDP with and without preferential attachment.

from validation.robustness import plot_pa_gdp_comparison, plot_pa_comovements

plot_pa_gdp_comparison(pa, show=True)
plot_pa_comovements(pa, show=True)

Entry Experiment Plots#

GDP growth and bankruptcy rates across tax rate levels.

from validation.robustness import plot_entry_comparison

plot_entry_comparison(entry, show=True)

API Reference#

Visualization for robustness analysis.

Generates co-movement plots (Figure 3.9 from the book), impulse-response function comparisons, sensitivity analysis summary plots, and structural experiment visualizations (Section 3.10.2).

validation.robustness.viz.plot_comovements(result, output_dir=None, show=True)[source]#

Plot Figure 3.9: co-movements at leads and lags.

Creates a 3x2 grid (5 panels + 1 empty) showing cross-correlations between HP-filtered GDP and five macroeconomic variables at lags -4 to +4. Baseline run shown as ‘+’, cross-simulation mean as ‘o’.

Parameters:
  • result (InternalValidityResult) – Result from run_internal_validity().

  • output_dir (Path or None) – Directory for saving figures. Uses default if None.

  • show (bool) – Whether to call plt.show().

validation.robustness.viz.plot_irf(result, output_dir=None, show=True)[source]#

Plot impulse-response function comparison.

Shows the baseline AR(2) IRF and the cross-simulation average AR(1) IRF.

Parameters:
  • result (InternalValidityResult) – Result from run_internal_validity().

  • output_dir (Path or None) – Directory for saving figures.

  • show (bool) – Whether to call plt.show().

validation.robustness.viz.plot_sensitivity_comovements(exp_result, output_dir=None, show=True)[source]#

Plot co-movement comparison for a sensitivity experiment.

Shows baseline vs extreme parameter values to illustrate how co-movement structure changes with parameter variation.

Parameters:
  • exp_result (ExperimentResult) – Result for one experiment from sensitivity analysis.

  • output_dir (Path or None) – Directory for saving figures.

  • show (bool) – Whether to call plt.show().

validation.robustness.viz.plot_pa_gdp_comparison(pa_result, output_dir=None, show=True, seed=0)[source]#

Plot GDP time series comparison: PA on vs PA off (Figure 3.10).

Runs two quick single-seed simulations to produce overlaid GDP time series showing how volatility drops when PA is disabled.

Parameters:
  • pa_result (PAExperimentResult) – Result from run_pa_experiment().

  • output_dir (Path or None) – Directory for saving figures.

  • show (bool) – Whether to call plt.show().

  • seed (int) – Seed for the comparison simulations.

validation.robustness.viz.plot_pa_comovements(pa_result, output_dir=None, show=True)[source]#

Plot co-movement comparison: baseline vs PA-off.

3x2 grid with both conditions overlaid. Shows price index and wages shifting to lagging/acyclical when PA is disabled.

Parameters:
  • pa_result (PAExperimentResult) – Result from run_pa_experiment().

  • output_dir (Path or None) – Directory for saving figures.

  • show (bool) – Whether to call plt.show().

validation.robustness.viz.plot_entry_comparison(entry_result, output_dir=None, show=True)[source]#

Plot entry neutrality results across tax rates.

Shows unemployment, GDP growth volatility, and collapse rate across profit tax rates. Monotonic degradation confirms entry mechanism does not artificially drive recovery.

Parameters:
  • entry_result (EntryExperimentResult) – Result from run_entry_experiment().

  • output_dir (Path or None) – Directory for saving figures.

  • show (bool) – Whether to call plt.show().