diff_diff.BusinessReport#

class diff_diff.BusinessReport[source]#

Bases: object

Produce a stakeholder-ready narrative from any diff-diff results object.

Parameters:
  • results (Any) – A fitted diff-diff results object. Any of the 16 result types is accepted. BaconDecompositionResults is not a valid input — Bacon is a diagnostic, not an estimator; use DiagnosticReport for that.

  • outcome_label (str, optional) – Stakeholder-friendly outcome name (e.g. "Revenue per user").

  • outcome_unit (str, optional) – Unit label: "$" / "%" / "pp" / "log_points" / "count" (recognized for formatting) or any free-form string (used verbatim without arithmetic translation).

  • outcome_direction (str, optional) – "higher_is_better" or "lower_is_better". Drives whether the effect is described as “lift” / “drag” rather than just “increase” / “decrease”.

  • business_question (str, optional) – Question the analysis answers (prepended to the summary).

  • treatment_label (str, optional) – Stakeholder-friendly treatment name (e.g. "the campaign").

  • alpha (float, optional) – Significance level. Defaults to results.alpha when not supplied. Single knob: drives both CI level and significance phrasing.

  • honest_did_results (HonestDiDResults or SensitivityResults, optional) – Pre-computed sensitivity result. When supplied, this is forwarded to the internal DiagnosticReport so sensitivity is not re-computed.

  • auto_diagnostics (bool, default True) – When True and diagnostics is None, auto-construct a DiagnosticReport. Set False to skip diagnostics entirely.

  • diagnostics (DiagnosticReport or DiagnosticReportResults, optional) – Explicit diagnostics object. Takes precedence over auto_diagnostics.

  • include_appendix (bool, default True) – Whether full_report() appends the estimator’s academic results.summary() output under a “Technical Appendix” section.

  • data (optional) – Raw panel + column names forwarded to the auto-constructed DiagnosticReport so data-dependent checks (2x2 PT on simple DiD, Bacon-from-scratch, EfficientDiD Hausman pretest) can run.

  • outcome (optional) – Raw panel + column names forwarded to the auto-constructed DiagnosticReport so data-dependent checks (2x2 PT on simple DiD, Bacon-from-scratch, EfficientDiD Hausman pretest) can run.

  • treatment (optional) – Raw panel + column names forwarded to the auto-constructed DiagnosticReport so data-dependent checks (2x2 PT on simple DiD, Bacon-from-scratch, EfficientDiD Hausman pretest) can run.

  • unit (optional) – Raw panel + column names forwarded to the auto-constructed DiagnosticReport so data-dependent checks (2x2 PT on simple DiD, Bacon-from-scratch, EfficientDiD Hausman pretest) can run.

  • time (optional) – Raw panel + column names forwarded to the auto-constructed DiagnosticReport so data-dependent checks (2x2 PT on simple DiD, Bacon-from-scratch, EfficientDiD Hausman pretest) can run.

  • first_treat (optional) – Raw panel + column names forwarded to the auto-constructed DiagnosticReport so data-dependent checks (2x2 PT on simple DiD, Bacon-from-scratch, EfficientDiD Hausman pretest) can run.

  • survey_design (SurveyDesign, optional) – The SurveyDesign object used to fit a survey-weighted estimator. Forwarded to the auto-constructed DiagnosticReport for fit-faithful Goodman-Bacon replay. When the fit carries survey_metadata but survey_design is 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-backed DiDResults it is skipped unconditionally regardless of survey_design. Supply precomputed={'parallel_trends': ...} with a survey-aware pretest to opt in. See docs/methodology/REPORTING.md.

  • precomputed (dict, optional) – Pre-computed diagnostic objects forwarded to the auto- constructed DiagnosticReport (same keys as DiagnosticReport(precomputed=...)): "parallel_trends", "sensitivity", "pretrends_power", "bacon". DR validates keys and rejects estimator-incompatible entries (e.g., HonestDiD bounds or generic PT on SDiD / TROP). honest_did_results remains a shorthand for sensitivity; an explicit precomputed['sensitivity'] wins on conflict.

Methods

__init__(results, *[, outcome_label, ...])

caveats()

Return the list of structured caveats (severity + topic + message).

export_markdown()

Alias for full_report() (discoverability).

full_report()

Return a structured multi-section markdown report.

headline()

Return just the headline sentence.

summary()

Return a short plain-English paragraph block (6-10 sentences).

to_dict()

Return the AI-legible structured schema (single source of truth).

to_json(*[, indent])

Return to_dict() serialized as JSON.

__init__(results, *, outcome_label=None, outcome_unit=None, outcome_direction=None, business_question=None, treatment_label=None, alpha=None, honest_did_results=None, auto_diagnostics=True, diagnostics=None, include_appendix=True, data=None, outcome=None, treatment=None, unit=None, time=None, first_treat=None, survey_design=None, precomputed=None)[source]#
Parameters:
classmethod __new__(*args, **kwargs)#