diff_diff.duration_did_results.DurationDiDPretestResults#

class diff_diff.duration_did_results.DurationDiDPretestResults[source]#

Bases: Diagnostic

Appendix B Algorithm 2 pre-treatment specification test.

For every interior pre-treatment date t (strictly between the baseline and anchor_period, the last pre-treatment date) the contrast compares the hazard relationship at t with its value at the fixed anchor: the average-hazard GAP under method="cd" and the cumulative-increment RATIO under method="ph". The whole-individual bootstrap gives one SD per contrast, a simultaneous critical value from the maximum absolute centered pivot, symmetric bands contrast +/- crit_value * se and the max-|t| statistic. The test rejects when any band excludes zero, which is exactly p_value <= alpha under the inverse-empirical-CDF quantile.

method#

"cd" or "ph".

Type:

str

periods#

The tested interior pre-treatment dates (J).

Type:

np.ndarray

anchor_period#

The last pre-treatment date (the fixed anchor).

Type:

Any

contrast#

Point contrasts, one per tested date (NaN when unavailable).

Type:

np.ndarray

se#

Bootstrap SDs of the contrasts (NaN when unavailable).

Type:

np.ndarray

band_lower, band_upper

Simultaneous bands at level 1 - alpha.

Type:

np.ndarray

crit_value#

Simultaneous critical value (NaN when unavailable).

Type:

float

statistic#

max |contrast / se| over the tested dates.

Type:

float

p_value#

Empirical tail fraction of the bootstrap maxima at or above statistic (NaN when unavailable).

Type:

float

reject#

True when any band excludes zero; None when unavailable.

Type:

bool or None

alpha#

Significance level.

Type:

float

n_bootstrap, n_bootstrap_valid

Requested draws and complete draws for this family.

Type:

int

status#

"ok", "disabled" (n_bootstrap=0), "unavailable_insufficient_pre_periods" (no interior pre-date), "unavailable_ph_support" (a zero control increment at a tested date or the anchor under PH), "unavailable_nonfinite_moments", "unavailable_failed_draws", or "unavailable_zero_se".

Type:

str

Methods

__init__(method, periods, anchor_period, ...)

summary()

Human-readable summary.

to_dataframe()

One row per tested pre-treatment date.

to_dict()

JSON-serializable dictionary.

Attributes

method

periods

anchor_period

contrast

se

band_lower

band_upper

crit_value

statistic

p_value

reject

alpha

n_bootstrap

n_bootstrap_valid

status

__init__(method, periods, anchor_period, contrast, se, band_lower, band_upper, crit_value, statistic, p_value, reject, alpha, n_bootstrap, n_bootstrap_valid, status)#
Parameters:
Return type:

None

classmethod __new__(*args, **kwargs)#