diff_diff.DiagnosticReport#
- class diff_diff.DiagnosticReport[source]#
Bases:
objectRun the standard diff-diff diagnostic battery on a fitted result.
- Parameters:
results (Any) – A fitted diff-diff results object (e.g.
CallawaySantAnnaResults,DiDResults,SyntheticDiDResults). Any of the 16 result types in the library is accepted.data (pandas.DataFrame, optional) – The underlying panel. Required for checks that need raw data (2x2 parallel-trends check on
DiDResults; Bacon-from-scratch whenresultsis not itself a Bacon fit; the opt-in placebo battery).outcome (str, optional) – Column names identifying the panel structure.
treatment (str, optional) – Column names identifying the panel structure.
time (str, optional) – Column names identifying the panel structure.
unit (str, optional) – Column names identifying the panel structure.
first_treat (str, optional) – Column names identifying the panel structure.
pre_periods (list, optional) – Explicit pre- and post-treatment period labels.
post_periods (list, optional) – Explicit pre- and post-treatment period labels.
run_parallel_trends (bool) – Per-check opt-in flags.
run_placebodefaults toFalse— the generic placebo battery is not implemented in MVP, so theplacebokey remains reserved asskippedin the schema. (Exception:SyntheticControl’s in-space placebo permutation test IS implemented — run it viaresults.in_space_placebo(); its result is surfaced underestimator_native_diagnostics.in_space_placebo, not this generic section.) All other checks default toTrueand are further gated by estimator-type and instance-level applicability (seedocs/methodology/REPORTING.md).run_sensitivity (bool) – Per-check opt-in flags.
run_placebodefaults toFalse— the generic placebo battery is not implemented in MVP, so theplacebokey remains reserved asskippedin the schema. (Exception:SyntheticControl’s in-space placebo permutation test IS implemented — run it viaresults.in_space_placebo(); its result is surfaced underestimator_native_diagnostics.in_space_placebo, not this generic section.) All other checks default toTrueand are further gated by estimator-type and instance-level applicability (seedocs/methodology/REPORTING.md).run_placebo (bool) – Per-check opt-in flags.
run_placebodefaults toFalse— the generic placebo battery is not implemented in MVP, so theplacebokey remains reserved asskippedin the schema. (Exception:SyntheticControl’s in-space placebo permutation test IS implemented — run it viaresults.in_space_placebo(); its result is surfaced underestimator_native_diagnostics.in_space_placebo, not this generic section.) All other checks default toTrueand are further gated by estimator-type and instance-level applicability (seedocs/methodology/REPORTING.md).run_bacon (bool) – Per-check opt-in flags.
run_placebodefaults toFalse— the generic placebo battery is not implemented in MVP, so theplacebokey remains reserved asskippedin the schema. (Exception:SyntheticControl’s in-space placebo permutation test IS implemented — run it viaresults.in_space_placebo(); its result is surfaced underestimator_native_diagnostics.in_space_placebo, not this generic section.) All other checks default toTrueand are further gated by estimator-type and instance-level applicability (seedocs/methodology/REPORTING.md).run_design_effect (bool) – Per-check opt-in flags.
run_placebodefaults toFalse— the generic placebo battery is not implemented in MVP, so theplacebokey remains reserved asskippedin the schema. (Exception:SyntheticControl’s in-space placebo permutation test IS implemented — run it viaresults.in_space_placebo(); its result is surfaced underestimator_native_diagnostics.in_space_placebo, not this generic section.) All other checks default toTrueand are further gated by estimator-type and instance-level applicability (seedocs/methodology/REPORTING.md).run_heterogeneity (bool) – Per-check opt-in flags.
run_placebodefaults toFalse— the generic placebo battery is not implemented in MVP, so theplacebokey remains reserved asskippedin the schema. (Exception:SyntheticControl’s in-space placebo permutation test IS implemented — run it viaresults.in_space_placebo(); its result is surfaced underestimator_native_diagnostics.in_space_placebo, not this generic section.) All other checks default toTrueand are further gated by estimator-type and instance-level applicability (seedocs/methodology/REPORTING.md).run_epv (bool) – Per-check opt-in flags.
run_placebodefaults toFalse— the generic placebo battery is not implemented in MVP, so theplacebokey remains reserved asskippedin the schema. (Exception:SyntheticControl’s in-space placebo permutation test IS implemented — run it viaresults.in_space_placebo(); its result is surfaced underestimator_native_diagnostics.in_space_placebo, not this generic section.) All other checks default toTrueand are further gated by estimator-type and instance-level applicability (seedocs/methodology/REPORTING.md).run_pretrends_power (bool) – Per-check opt-in flags.
run_placebodefaults toFalse— the generic placebo battery is not implemented in MVP, so theplacebokey remains reserved asskippedin the schema. (Exception:SyntheticControl’s in-space placebo permutation test IS implemented — run it viaresults.in_space_placebo(); its result is surfaced underestimator_native_diagnostics.in_space_placebo, not this generic section.) All other checks default toTrueand are further gated by estimator-type and instance-level applicability (seedocs/methodology/REPORTING.md).sensitivity_M_grid (tuple of float, default (0.5, 1.0, 1.5, 2.0)) – Grid of M values passed to
HonestDiD.sensitivity. Yields aSensitivityResultsobject withbreakdown_Mpopulated.sensitivity_method (str, default "relative_magnitude") – HonestDiD restriction type.
alpha (float, default 0.05) – Significance level used across checks.
survey_design (SurveyDesign, optional) – The
SurveyDesignobject used to fit a survey-weighted estimator. Required for fit-faithful replay of Goodman-Bacon on a survey-backed fit; threaded tobacon_decompose(survey_design=...). When the fit carriessurvey_metadatabutsurvey_designis not supplied, Bacon is skipped with an explicit reason rather than replaying an unweighted decomposition for a design that does not match the estimate. The simple 2x2 parallel-trends helper (utils.check_parallel_trends) has no survey-aware variant; on a survey-backedDiDResultsit is skipped unconditionally regardless ofsurvey_design. Supplyprecomputed={'parallel_trends': ...}with a survey-aware pretest to opt in. Seedocs/methodology/REPORTING.md.precomputed (dict, optional) –
Map of check name to a pre-computed result object. Accepted keys (this is the full implemented list; unsupported keys raise
ValueError):"parallel_trends"— a dict returned byutils.check_parallel_trends(adapted into the schema shape)."sensitivity"— aSensitivityResults(grid) orHonestDiDResults(single-M) object; used verbatim and noHonestDiD.sensitivity_analysiscall is made."pretrends_power"— aPreTrendsPowerResultsobject."bacon"— aBaconDecompositionResultsobject.
Other sections (
design_effect,heterogeneity,epv) are read directly from the fitted result object and do not currently accept precomputed values — there is no expensive call to bypass.placebois reserved in the schema but opt-in / deferred in MVP for the generic battery;SyntheticControlsurfaces its in-space placebo underestimator_native_diagnostics(runresults.in_space_placebo()).outcome_label (str, optional) – Plain-English labels used in prose rendering.
treatment_label (str, optional) – Plain-English labels used in prose rendering.
Methods
__init__(results, *[, data, outcome, ...])export_markdown()Alias for
full_report().full_report()Return the multi-section markdown report.
run_all()Run all applicable diagnostics.
summary()Return a short plain-English paragraph.
to_dataframe()Return one row per check with status and headline metric.
to_dict()Return the AI-legible structured schema.
Attributes
applicable_checksNames of checks that will run, given estimator + instance + options.
skipped_checksMapping of skipped check -> plain-English reason.
- __init__(results, *, data=None, outcome=None, treatment=None, time=None, unit=None, first_treat=None, pre_periods=None, post_periods=None, run_parallel_trends=True, run_sensitivity=True, run_placebo=False, run_bacon=True, run_design_effect=True, run_heterogeneity=True, run_epv=True, run_pretrends_power=True, sensitivity_M_grid=(0.5, 1.0, 1.5, 2.0), sensitivity_method='relative_magnitude', alpha=0.05, survey_design=None, precomputed=None, outcome_label=None, treatment_label=None)[source]#
- Parameters:
results (Any)
data (DataFrame | None)
outcome (str | None)
treatment (str | None)
time (str | None)
unit (str | None)
first_treat (str | None)
run_parallel_trends (bool)
run_sensitivity (bool)
run_placebo (bool)
run_bacon (bool)
run_design_effect (bool)
run_heterogeneity (bool)
run_epv (bool)
run_pretrends_power (bool)
sensitivity_method (str)
alpha (float)
survey_design (Any | None)
outcome_label (str | None)
treatment_label (str | None)
- classmethod __new__(*args, **kwargs)#