diff_diff.QDiD#

class diff_diff.QDiD[source]#

Bases: object

Quantile Difference-in-Differences comparison estimator (2x2 design).

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, matching qte::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 ChangesInChanges over 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 xformla branch 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).

Constructor parameters, fit signature, bootstrap behavior, and the results container are identical to ChangesInChanges (no interior-range guard: eq. 17 has no QDiD analogue).

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])

Return constructor hyperparameters (raw values, round-trips __init__).

set_params(**params)

Set hyperparameters transactionally (a failing call mutates nothing).

__init__(quantiles=None, n_bootstrap=200, alpha=0.05, panel=False, seed=None)[source]#
Parameters:
classmethod __new__(*args, **kwargs)#