estimate_quantile_did_effects
distributional_did.estimate_quantile_did_effects(
ds: pl.DataFrame,
outcome: ColumnName,
treatment_group: ColumnName | TrtGroupConfig,
time: ColumnName,
unit: ColumnName,
qs: ArrayLike = MEDIAN,
*,
weights: ColumnName | None = None,
n_anticipation_periods: int = 0,
base_period: BasePeriod = BasePeriod.UNIVERSAL,
control_group: ControlGroup = ControlGroup.NEVER_TREATED,
bootstrap_config: BootstrapConfig | int = 1000,
)Estimate quantile treatment effects with quantile difference-in-differences.
Quantile difference-in-differences applies difference-in-differences to every quantile instead of to the mean: each treated pre-treatment observation is shifted by the change over time of the control group at the same quantile. It is identified by an additively separable model whose unobservables must be identically distributed in all groups and periods, which rules out the treated and untreated groups differing in the distribution of unobservables. Under continuity, the implied average treatment effect equals that of the mean difference-in-differences estimator, even though the counterfactual distributions differ. Returns the group, event-study, overall and group-time effects.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| ds | polars.DataFrame |
Panel data in long format. | required |
| outcome | ColumnName |
Name of the outcome column. | required |
| treatment_group | ColumnName or TrtGroupConfig |
Column holding the first treatment period of a unit. A plain string treats the column as already coded with inf for never-treated units; a TrtGroupConfig maps a custom never-treated value to inf. |
required |
| time | ColumnName |
Name of the time period column. | required |
| unit | ColumnName |
Name of the unit identifier column. | required |
| qs | array_like |
Quantiles in (0, 1) at which to estimate the effects. |
0.5 |
| weights | ColumnName |
Name of a column with sampling weights. | None |
| n_anticipation_periods | int |
Number of periods before treatment in which units may anticipate it. | 0 |
| base_period | BasePeriod |
Pre-treatment period used for the comparisons. | BasePeriod.UNIVERSAL |
| control_group | ControlGroup |
Comparison group used for the counterfactual. | ControlGroup.NEVER_TREATED |
| bootstrap_config | BootstrapConfig or int |
Bootstrap settings, or the number of replications. | 1000 |
Returns
| Name | Type | Description |
|---|---|---|
DistributionalDidResults |
The group, event-study, overall and group-time effects. |
See Also
estimate_changes_in_changes_effects Does not require the unobservables to be identically distributed across groups.
References
Athey, Susan and Guido Imbens. “Identification and Inference in Nonlinear Difference-in-Differences Models.” Econometrica 74(2), pp. 431-497, 2006, Section 3.3.