estimate_distributional_did_effects
distributional_did.estimate_distributional_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 distributional difference-in-differences.
Combines a distributional parallel trends assumption – the distribution of the change in untreated potential outcomes is the same for the treated and untreated groups – with the assumption that the dependence, that is the copula, between the change in untreated potential outcomes and the initial level of untreated potential outcomes is the same for the two groups. The initial distribution of outcomes is allowed to differ between the groups, which is what distinguishes this estimator from quantile difference-in-differences, where the unobservables must be identically distributed everywhere. The counterfactual pairs each control unit’s own change over time with the treated outcome at that unit’s rank, so it needs the same units in both periods of a cell, and it is indexed on the control units, which means the distribution of individual treatment effects is not identified. 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_mean_did_effects A location-shift restriction that identifies only the average effect. estimate_quantile_did_effects Requires the unobservables to be identically distributed across groups.
References
Callaway, Brantly, Tong Li and Tatsushi Oka. “Quantile Treatment Effects in Difference in Differences Models under Dependence Restrictions and with Only Two Time Periods.” Journal of Econometrics 206(2), pp. 395-413, 2018.