diff_diff.QDiD#
- class diff_diff.QDiD[source]#
Bases:
BaseEstimatorQuantile Difference-in-Differences comparison estimator (2x2 design).
Deprecated since version 3.9: Use
ChangesInChanges(method="qdid")instead; this class is removed in 4.0 (ledger row M-015). The ESTIMATOR is not deprecated - only this class spelling. The merged surface runs the same engine, so the numbers are unchanged, andmethod="qdid"emits no warning of its own.Applies DiD quantile-by-quantile:
qte(tau) = Q(y11, tau) - [Q(y10, tau) + Q(y01, tau) - Q(y00, tau)]with R type-7 (linear-interpolation) quantiles, matchingqte::QDiD()(v1.3.1) exactly - including its ATT formula, which evaluates the control-group quantile functions at the treated pre-period’s own-sample ranks. This finite-sample form deviates from the Athey-Imbens k^QDID transformation mean (they are population-equivalent; see the labeled Note in the methodology registry).Athey & Imbens recommend
ChangesInChangesover QDiD (2006, p. 447): QDiD’s justifying model is not invariant to monotone transformations of the outcome, forces the unobservable distribution to be identical across all four cells, and places testable restrictions on the data (in unconditional fits, a warning fires when the implied counterfactual quantile function is non-monotone; with covariates the check is moot - the imputed counterfactual’s quantile curve is monotone by construction). QDiD’s mean effect matches standard DiD’s ATT in population; the paper provides no asymptotic theory for QDiD, so inference is a bootstrap convention shared with the qte package.Covariates port qte’s
xformlabranch exactly: quantile regressions in THREE cells (both control cells plus treated-pre), conditional ranks from the treated pre-period cell’s own conditional distribution, and an additive imputation. qte’s covariate QDiD mixes quantile types - type-7 for the treated post-period quantiles, type-1 for the imputed counterfactual - and that asymmetry is ported verbatim (REGISTRY Note).Fit signature, bootstrap behavior, and the results container are identical to
ChangesInChanges(no interior-range guard: eq. 17 has no QDiD analogue). The constructor parameters are identical EXCEPT that the merged class additionally carriesmethod=, which is what selects this estimator there; this class deliberately keeps its frozen five-parameter signature through removal, soQDiD(method=...)is not accepted.Methods
__init__([quantiles, n_bootstrap, alpha, ...])fit(data[, outcome, treatment, time, ...])Fit the QDiD estimator on a 2x2 dataset (see ChangesInChanges.fit).
get_params([deep])Get estimator parameters (sklearn-compatible).
set_params(**params)Set estimator parameters (sklearn-compatible, transactional).
- classmethod __new__(*args, **kwargs)#