diff_diff.duration_did_results.DurationDiDResults#
- class diff_diff.duration_did_results.DurationDiDResults[source]#
Bases:
BaseResults,AggregationMixinResults of
DurationDiD.The headline
attis the uniform average over the post-treatment dates of the absorption ATTE[Y_t - Y_t(0) | treated](positive = more cumulative absorption/exit than the counterfactual). Per-date effects and both band families live in the*_by_period/cband_*fields. Inference is whole-individual pooled bootstrap only; every family is either available (inference_status == "ok") or fully withheld.- att, se, t_stat, p_value, conf_int
Headline inference (centered-bootstrap SD, p-value and symmetric interval).
p_value <= alphais exactly the band rule.
- n_treated, n_control
Individuals per group.
- Type:
- periods#
The common time grid (all dates, sorted).
- Type:
np.ndarray
- last_pre_period#
The last untreated date (
tstar).- Type:
Any
- post_periods#
Dates strictly after
last_pre_period(the declared post family).- Type:
np.ndarray
- pre_periods, pre_period_weights
The realized fitting dates and their normalized weights.
- Type:
np.ndarray
- survival_treated, survival_control, counterfactual_survival
Group survival curves and the imputed treated counterfactual over the whole grid (pre-dates are the fitted values); NaN where no counterfactual exists or the value is non-finite.
- Type:
np.ndarray
- att_by_period, se_by_period, t_stat_by_period, p_value_by_period
Per post-date effect and pointwise inference.
- conf_int_by_period#
(P, 2)pointwise intervals.- Type:
np.ndarray
- pointwise_crit_values, cband_lower, cband_upper, cband_crit_value
Pointwise critical values and the simultaneous band.
- vcov#
(P, P)bootstrap covariance of the post-date effects;Nonewhenever the post family is unavailable.- Type:
np.ndarray or None
- curve_status, period_status
Validity of the imputed counterfactual curve at every date / every post-date (
"ok","control_survival_zero","counterfactual_nonfinite","counterfactual_survival_above_one","counterfactual_nonmonotone").
- inference_status#
"ok","disabled","unavailable_invalid_periods","unavailable_failed_draws"or"unavailable_zero_se".- Type:
- bootstrap_effects#
(n_bootstrap, P)raw post-effect draws (NaN rows for failed draws). Statistics of the completed draws are diagnostics, never inference.- Type:
np.ndarray or None
- n_draws_invalid_counterfactual#
Complete post-family draws whose imputed counterfactual curve left the domain (survival above one or a decreasing cumulative hazard). Such draws are well-defined statistics and are NOT failures, but a large share signals weak support for the CD extrapolation; reported in
summary()as a count and a share of the complete draws.- Type:
- pretest#
The Algorithm 2 specification test (always populated).
Methods
__init__(att, se, t_stat, p_value, conf_int, ...)aggregate(type[, weights, balance_e])Re-aggregate this fit without refitting.
print_summary([alpha])Print
summary().summary([alpha])Formatted summary.
to_dataframe([level])Tabular view.
to_dict()JSON-serializable dictionary (arrays as lists, scalars native).
Attributes
is_significantthe headline centered-bootstrap interval excludes zero.
significance_starsSignificance stars for the headline p-value ("" when NaN).
attset_statp_valueconf_intalphan_bootstrapn_bootstrap_validn_bootstrap_valid_pretestseedn_treatedn_controln_periodspre_periodspre_period_weightsph_ratio_boundaryn_treated_survivors_at_last_pren_control_survivors_at_horizonsurvival_treatedsurvival_controlcounterfactual_survivalatt_by_periodse_by_periodt_stat_by_periodp_value_by_periodpointwise_crit_valuescband_lowercband_uppercband_crit_valuecurve_statusperiod_status- __init__(att, se, t_stat, p_value, conf_int, method, alpha, n_bootstrap, n_bootstrap_valid, n_bootstrap_valid_pretest, seed, n_units, n_obs, n_treated, n_control, n_periods, periods, last_pre_period, post_periods, pre_periods, pre_period_weights, excluded_pre_periods, coefficient, ph_ratio_boundary, n_treated_survivors_at_last_pre, n_control_survivors_at_horizon, survival_treated, survival_control, counterfactual_survival, att_by_period, se_by_period, t_stat_by_period, p_value_by_period, conf_int_by_period, pointwise_crit_values, cband_lower, cband_upper, cband_crit_value, joint_p_value, vcov, curve_status, period_status, inference_status, bootstrap_effects, bootstrap_failure_reasons, n_draws_invalid_counterfactual, pretest)#
- Parameters:
att (float)
se (float)
t_stat (float)
p_value (float)
method (str)
alpha (float)
n_bootstrap (int)
n_bootstrap_valid (int)
n_bootstrap_valid_pretest (int)
seed (int | None)
n_units (int)
n_obs (int)
n_treated (int)
n_control (int)
n_periods (int)
periods (ndarray)
last_pre_period (Any)
post_periods (ndarray)
pre_periods (ndarray)
pre_period_weights (ndarray)
coefficient (float)
ph_ratio_boundary (bool)
n_treated_survivors_at_last_pre (int)
n_control_survivors_at_horizon (int)
survival_treated (ndarray)
survival_control (ndarray)
counterfactual_survival (ndarray)
att_by_period (ndarray)
se_by_period (ndarray)
t_stat_by_period (ndarray)
p_value_by_period (ndarray)
conf_int_by_period (ndarray)
pointwise_crit_values (ndarray)
cband_lower (ndarray)
cband_upper (ndarray)
cband_crit_value (float)
joint_p_value (float)
vcov (ndarray | None)
inference_status (str)
bootstrap_effects (ndarray | None)
n_draws_invalid_counterfactual (int)
pretest (DurationDiDPretestResults)
- Return type:
None
- classmethod __new__(*args, **kwargs)#