diff_diff.dml_did_results.DMLDiDResults#

class diff_diff.dml_did_results.DMLDiDResults[source]#

Bases: CallawaySantAnnaResults

Results from DMLDiD (Chang 2020 DML DiD, staggered ATT(g,t)).

Inherits the full Callaway-Sant’Anna results surface — att/se aliases, to_dataframe, post-fit aggregate() (simple / event_study / group, plus total on panel non-survey fits; repeated-cross-section AND declared-survey fits fail total closed) with bootstrap replay — and adds the DML provenance fields below. cluster_name/ n_clusters/df_inference/survey_metadata are populated on survey/cluster= fits (CS conventions: survey_metadata marks a DECLARED design; df_inference carries the bare-cluster df). Every inherited CS-only field that DMLDiD never populates (epv_*, pscore_fallback, allow_unbalanced_panel, used_rc_on_unbalanced_panel, influence_functions, event_study_effects/event_study_vcov/event_study_vcov_index/ event_study_df) stays at its inherited default and is inert. group_effects stays None permanently — aggregate("group") returns a separate container and never mutates this object. panel is NOT inert: it carries the fit’s DECLARED design — True for the Case 1 panel lane, False for the Case 2 repeated-cross-section lane (DMLDiD(panel=False)) — and report rendering plus the aggregation n_kind read it for “units” vs “observations” semantics.

propensity_learner, outcome_learner

The learner specs as configured — the string name verbatim; a passed LIBRARY-native learner object keeps its configuration-aware repr(); a FOREIGN object is recorded as its qualified class name only (its __repr__ could embed sensitive content). Never the object itself: result pickles must not retain arbitrary user objects.

Type:

str

n_folds#

Cross-fitting fold count K as REQUESTED (the configuration value).

Type:

int

effective_n_folds#

The REALIZED fold count when it differs from n_folds — set only when a coarse survey/cluster PSU design reduced K to the global PSU count to preserve cluster cohesion (warned at fit); None otherwise.

Type:

int, optional

cross_fit_diagnostics#

Per-(g, t) cross-fit diagnostics: per-stage fold losses and fit counts, p_hat, propensity clip count, and the fold-seed derivation. Cells that failed before fold assignment carry no entry.

Type:

dict, optional

seed#

Root seed for the per-cell fold draws (and the bootstrap when enabled). With seed=None the recorded per-fit entropy is drawn from OS randomness.

Type:

int, optional

n_bootstrap, bootstrap_weights, cband

Multiplier-bootstrap configuration used at fit.

bad_control#

The bad-control column of a Caetano, Callaway, Payne & Sant’Anna (2026) fit (fit(bad_control=...)); None on plain Chang fits.

Type:

str, optional

bad_control_covariates#

The W columns (user order; the outcome name means the outcome at the cell’s base period); () when a bad control was declared without W; None on plain fits.

Type:

tuple of str, optional

bad_control_diagnostics#

Per-(g, t) ATT_X(g, t) pre-test (Remark 6): the AIPW mean-effect of treatment on the bad control at t (pre-period cells assess MP-5 / MP-8 and should be zero; post-period cells check that treatment affects the covariate) with keys effect/se/t_stat/p_value/conf_int/n_treated/ n_control. Analytical SE only (never bootstrapped or aggregated). Retained cells only; None on plain fits. Read through bad_control_summary().

Type:

dict, optional

Methods

__init__(group_time_effects, overall_att, ...)

aggregate(type[, weights, balance_e])

Re-aggregate this fit without refitting.

bad_control_summary()

Per-cell ATT_X(g, t) pre-test table (Caetano et al. 2026, Remark 6).

epv_summary([show_all])

Return per-cohort EPV diagnostics as a DataFrame.

print_summary([alpha])

Print summary to stdout.

summary([alpha])

Formatted summary with the DML banner and cross-fit header block.

to_dataframe([level])

Parent DataFrame; on bad-control fits the group_time level gains att_x / se_x (analytical, unlike a bootstrapped se).

to_dict()

Headline dict extended with DML provenance (JSON-serializable).

Attributes

allow_unbalanced_panel

alpha

anticipation

att

bad_control

bad_control_covariates

bad_control_diagnostics

base_period

bootstrap_results

bootstrap_weights

cband

cband_crit_value

cluster_name

coef_var

SE / abs(overall ATT).

conf_int

control_group

cross_fit_diagnostics

df_inference

effective_n_folds

epv_diagnostics

epv_threshold

event_study_df

event_study_effects

event_study_vcov

event_study_vcov_index

group_effects

influence_functions

is_significant

Check if overall ATT is significant.

n_bootstrap

n_clusters

n_folds

outcome_learner

p_value

panel

propensity_learner

pscore_fallback

pscore_trim

reference_event_times

se

seed

significance_stars

Significance stars for overall ATT.

survey_metadata

t_stat

used_rc_on_unbalanced_panel

vcov_type

group_time_effects

overall_att

overall_se

overall_t_stat

overall_p_value

overall_conf_int

groups

time_periods

n_obs

n_treated_units

n_control_units

__init__(group_time_effects, overall_att, overall_se, overall_t_stat, overall_p_value, overall_conf_int, groups, time_periods, n_obs, n_treated_units, n_control_units, alpha=0.05, control_group='never_treated', base_period='varying', anticipation=0, panel=True, allow_unbalanced_panel=False, used_rc_on_unbalanced_panel=False, event_study_effects=None, group_effects=None, influence_functions=None, event_study_vcov=None, event_study_vcov_index=None, event_study_df=None, bootstrap_results=None, cband_crit_value=None, pscore_trim=0.01, survey_metadata=None, epv_diagnostics=None, epv_threshold=10, pscore_fallback='error', vcov_type='hc1', cluster_name=None, n_clusters=None, df_inference=None, reference_event_times=None, _aggregation_kit=None, propensity_learner='logit', outcome_learner='linear', n_folds=5, effective_n_folds=None, cross_fit_diagnostics=None, seed=None, n_bootstrap=0, bootstrap_weights=None, cband=True, bad_control=None, bad_control_covariates=None, bad_control_diagnostics=None)#
Parameters:
Return type:

None

classmethod __new__(*args, **kwargs)#