diff_diff.duration_did_results.DurationDiDResults#

class diff_diff.duration_did_results.DurationDiDResults[source]#

Bases: BaseResults, AggregationMixin

Results of DurationDiD.

The headline att is the uniform average over the post-treatment dates of the absorption ATT E[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 <= alpha is exactly the band rule.

method#

"cd" or "ph".

Type:

str

n_units#

Individuals (the bootstrap resampling unit).

Type:

int

n_obs#

Panel rows used (n_units * n_periods).

Type:

int

n_treated, n_control

Individuals per group.

Type:

int

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

excluded_pre_periods#

Candidate fitting dates that were excluded, with the reason.

Type:

dict

coefficient#

Fitted CD gap c (per unit of time) or PH ratio c.

Type:

float

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.

joint_p_value#

Simultaneous p-value for the null that every post-date effect is zero.

Type:

float

vcov#

(P, P) bootstrap covariance of the post-date effects; None whenever 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").

Type:

list of str

inference_status#

"ok", "disabled", "unavailable_invalid_periods", "unavailable_failed_draws" or "unavailable_zero_se".

Type:

str

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

bootstrap_failure_reasons#

{"post": {reason: count}, "pretest": {reason: count}}.

Type:

dict

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:

int

pretest#

The Algorithm 2 specification test (always populated).

Type:

DurationDiDPretestResults

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_significant

the headline centered-bootstrap interval excludes zero.

significance_stars

Significance stars for the headline p-value ("" when NaN).

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

__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:
Return type:

None

classmethod __new__(*args, **kwargs)#