diff_diff.placebo_group_test#
- diff_diff.placebo_group_test(data, outcome, time, unit, fake_treated_units, post_periods=None, alpha=0.05, treatment=None, **estimator_kwargs)[source]
Test for differential trends by designating control units as “fake treated”.
Designates
fake_treated_unitsas fake-treated and estimates a DiD on the resulting panel. A significant effect suggests heterogeneous trends in the control group (a parallel-trends red flag).If
treatmentis provided, units that are ever really treated are dropped first, so the placebo runs on never-treated units only (the recommended, uncontaminated design). IftreatmentisNone, the test runs on whatever data is supplied, so the caller must pass control-only data for a valid placebo.- Parameters:
data (pd.DataFrame) – Panel data.
outcome (str) – Outcome variable column.
time (str) – Time period column.
unit (str) – Unit identifier column.
fake_treated_units (list) – List of control unit IDs to designate as “fake treated”.
post_periods (list, optional) – List of post-treatment period values.
alpha (float, default=0.05) – Significance level.
treatment (str, optional) – Real treatment-indicator column. When given, units that are ever real-treated (
data.groupby(unit)[treatment].max() == 1) are dropped before the placebo, so it runs on never-treated units only. WhenNone(default), no filtering is done and the caller must pass control-only data.**estimator_kwargs – Arguments passed to DifferenceInDifferences.
- Returns:
Results of the fake group placebo test.
- Return type: