diff_diff.SpilloverDiDResults#
- class diff_diff.SpilloverDiDResults[source]#
Bases:
DiDResultsResults from a ring-indicator spillover-aware DiD estimation (Butts 2021).
Extends
DiDResultswith per-ring spillover effect estimates and diagnostic counts for the identifying control population.- spillover_effects#
Per-ring spillover-on-control estimates. Columns:
["coef", "se", "t_stat", "p_value", "ci_low", "ci_high"]. Index: ring label like"[0, 50)"; for event-study output the index is aMultiIndexover(ring_label, event_time).- Type:
pd.DataFrame, optional
- d_bar#
Far-away cutoff (Butts Assumption 5). Equals
max(ring_breakpoints)unless explicitly overridden.- Type:
- n_units_ever_in_ring#
Counts of UNIQUE units that appear in each ring AT LEAST ONCE across observed periods. Under staggered timing the ring membership is time-varying, so a unit can be counted in multiple rings (one per period it visits). Under non-staggered timing the rings are unit-static, so this is a clean partition (each unit appears in exactly one ring or the far-away group). Includes treated units in Ring_1 by geometric construction even though the
(1 - D_it)factor zeros their stage-2 contribution.
- n_far_away_obs#
Number of observations with
D_it = 0ANDd_it > d_bar; these observations identify the counterfactual trend (Butts Assumption 5(ii)). Under Wave E.3, on the survey path this count is reported on the EFFECTIVE WEIGHTED ESTIMATION SAMPLE (count_mask = survey_finite_mask= finite_mask ANDsurvey_weights > 0), so zero-weight rows fromSurveyDesign.subpopulation()are excluded — matches the Wave E.3n_obs/n_treated/n_controlcontract. The upstream_validate_far_away_existsgate still fires on the FULL DOMAIN at fit-time (Assumption 5(ii) requires at least one far-away identifying row); this metadata only reports the count on the active sample.- Type:
- event_study#
True if per-event-time ring coefficients were emitted (i.e.,
self.event_study=Truewas set on the estimator).- Type:
- stage1_n_obs#
Number of observations in the stage-1 untreated-and-unexposed subsample (
Omega_0_butts).- Type:
Methods
__init__(att, se, t_stat, p_value, conf_int, ...)print_summary([alpha])Print the summary to stdout.
summary([alpha])Extended summary with ATT row, per-event-time direct block, and per-(ring, event-time) spillover block.
to_dataframe()Convert results to a pandas DataFrame.
to_dict()Override to serialize
spillover_effectsDataFrame as list-of-dicts.Attributes
alphaanticipationatt_dynamicbootstrap_distributioncluster_namecoef_varSE / abs(ATT).
coefficientsconley_lag_cutoffevent_study_effectsfitted_valueshorizon_maxinference_methodis_significantCheck if the ATT is statistically significant at the alpha level.
n_bootstrapn_clustersn_psun_stratar_squaredreference_periodresidualssignificance_starsReturn significance stars based on p-value.
survey_metadatavcovvcov_typeset_statp_valueconf_intn_obsn_treatedn_control- __init__(att, se, t_stat, p_value, conf_int, n_obs, n_treated, n_control, alpha=0.05, coefficients=None, vcov=None, residuals=None, fitted_values=None, r_squared=None, inference_method='analytical', n_bootstrap=None, n_clusters=None, bootstrap_distribution=None, survey_metadata=None, vcov_type=None, cluster_name=None, conley_lag_cutoff=None, spillover_effects=None, ring_breakpoints=None, d_bar=None, n_units_ever_in_ring=None, n_far_away_obs=None, is_staggered=None, event_study=None, stage1_n_obs=None, anticipation=None, att_dynamic=None, event_study_effects=None, horizon_max=None, reference_period=None, n_psu=None, n_strata=None)#
- Parameters:
att (float)
se (float)
t_stat (float)
p_value (float)
n_obs (int)
n_treated (int)
n_control (int)
alpha (float)
vcov (ndarray | None)
residuals (ndarray | None)
fitted_values (ndarray | None)
r_squared (float | None)
inference_method (str)
n_bootstrap (int | None)
n_clusters (int | None)
bootstrap_distribution (ndarray | None)
survey_metadata (Any | None)
vcov_type (str | None)
cluster_name (str | None)
conley_lag_cutoff (int | None)
spillover_effects (DataFrame | None)
d_bar (float | None)
n_far_away_obs (int | None)
is_staggered (bool | None)
event_study (bool | None)
stage1_n_obs (int | None)
anticipation (int | None)
att_dynamic (DataFrame | None)
horizon_max (int | None)
reference_period (int | None)
n_psu (int | None)
n_strata (int | None)
- Return type:
None
- classmethod __new__(*args, **kwargs)#