OutcomeFalsification#

class causalpy.checks.outcome_falsification.OutcomeFalsification[source]#

Outcome falsification sensitivity check.

Re-fits the experiment with alternative formulas and reports the estimated effect size for each. This is an informational check – it does not make pass/fail judgments. The researcher compares effect sizes across outcomes to assess whether the pattern is consistent with their causal story.

Parameters:
  • formulas (list[str]) – Falsification formulas. Each must be a complete patsy formula (e.g., "beer ~ 1 + year"). The outcome variable must exist in the data.

  • alpha (float) – Significance level. The HDI probability is 1 - alpha.

  • store_experiments (bool) – If True (default), each FalsificationResult retains a reference to the fitted experiment (including its InferenceData), which lets users inspect posteriors but can be memory-heavy for many formulas. Set to False to keep only the summary statistics (effect_mean, hdi_lower, hdi_upper). A one-off warning is emitted at run() when store_experiments=True and at least 3 formulas are supplied, because the combined InferenceData footprint of several fitted experiments can easily reach hundreds of MB on larger datasets (e.g. PiecewiseITS).

Examples

>>> import causalpy as cp
>>> check = cp.checks.OutcomeFalsification(
...     formulas=["beer ~ 1 + year", "lnincome ~ 1 + year"],
... )

Methods

OutcomeFalsification.run(experiment, context)

Run outcome falsification analysis.

OutcomeFalsification.validate(experiment)

Verify the experiment is compatible with OutcomeFalsification.

Attributes

applicable_methods

__init__(formulas, alpha=0.05, store_experiments=True)[source]#
Parameters:
Return type:

None

classmethod __new__(*args, **kwargs)#