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 is1 - alpha.store_experiments (
bool) – IfTrue(default), eachFalsificationResultretains a reference to the fitted experiment (including itsInferenceData), which lets users inspect posteriors but can be memory-heavy for many formulas. Set toFalseto keep only the summary statistics (effect_mean,hdi_lower,hdi_upper). A one-off warning is emitted atrun()whenstore_experiments=Trueand at least3formulas are supplied, because the combinedInferenceDatafootprint 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- classmethod __new__(*args, **kwargs)#