-
-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy path31-changes-in-changes.Rmd
More file actions
281 lines (215 loc) · 15.1 KB
/
31-changes-in-changes.Rmd
File metadata and controls
281 lines (215 loc) · 15.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# Changes-in-Changes {#sec-changes-in-changes}
The Changes-in-Changes (CiC) estimator, introduced by @athey2006identification, is an alternative to the [Difference-in-Differences](#sec-difference-in-differences) strategy. While traditional DiD estimates the [Average Treatment Effect on the Treated] (ATT), CiC focuses on the **Quantile Treatment Effect on the Treated (QTT)**.
Policymakers and analysts often look beyond average program impacts to understand how benefits are distributed across different subgroups. The QTT approach is particularly useful in cases where:
- **Policy decisions depend on distributional effects:**
- For instance, consider two job training programs with the same negative average effect.
- If one program harms high-income earners while benefiting low-income earners, it might still be considered valuable, whereas a program that negatively affects low-income earners might be rejected.
- **Limitations of traditional methods:**
- Methods such as linear regression assume uniform treatment effects across the population, which may mask important distributional differences.
- **Advantages of QTE methods:**
- Quantile treatment effects (QTEs) allow for a more detailed examination of how treatment effects vary across different segments of a population.
- While QTEs provide distributional insights, they can also be used to recover ATEs under weaker assumptions.
<!-- -->
- **References**
- @athey2006identification
- @frolich2013unconditional: IV-based
- @callaway2019quantile: panel data
- @huber2022direct
- **Additional Resources**
- Code examples available in [Stata](https://sites.google.com/site/blaisemelly/home/computer-programs/cic_stata).
## Key Concepts
- **Quantile Treatment Effect on the Treated (QTT):**
- Measures the difference in quantiles of the potential outcome distributions for treated units.
- **Rank Preservation:**
- Assumes that the rank of an individual remains unchanged across different potential outcome distributions.
- This is a **strong assumption** and should be considered carefully in empirical applications.
- **Counterfactual Distribution:**
- The main estimation challenge in CiC is constructing the **counterfactual distribution** of outcomes for treated units in period 1.
## Estimating QTT with CiC
The estimation logic mirrors DiD's, with one twist: instead of differencing means, CiC differences entire *distributions*. The recipe maps each treated unit's pre-treatment rank in the treated distribution to the corresponding rank in the control distribution, then asks how that rank's outcome would have evolved over time, had the treatment not occurred.
CiC relies on four distributions from a 2 × 2 Difference-in-Differences (DiD) setup:
1. $F_{Y(0),00}$: CDF of $Y(0)$ for control units in period 0.
2. $F_{Y(0),10}$: CDF of $Y(0)$ for treatment units in period 0.
3. $F_{Y(0),01}$: CDF of $Y(0)$ for control units in period 1.
4. $F_{Y(1),11}$: CDF of $Y(1)$ for treatment units in period 1.
The Quantile Treatment Effect on the Treated (QTT) at quantile $\theta$ is:
$$
\Delta_\theta^{QTT} = F_{Y(1), 11}^{-1} (\theta) - F_{Y (0), 11}^{-1} (\theta)
$$
To estimate the counterfactual CDF:
$$
\hat{F}_{Y(0),11}(y) = F_{y,01}\left(F^{-1}_{y,00}\left(F_{y,10}(y)\right)\right)
$$
This leads to the estimation of the inverse counterfactual CDF:
$$
\hat{F}^{-1}_{Y(0),11}(\theta) = F^{-1}_{y,01}\left(F_{y,00}\left(F^{-1}_{y,10}(\theta)\right)\right)
$$
Finally, the treatment effect estimate is:
$$
\hat{\Delta}^{CIC}_{\theta} = F^{-1}_{Y(1),11}(\theta) - \hat{F}^{-1}_{Y(0),11}(\theta)
$$
Alternatively, CiC can be expressed as the difference between two QTE estimates:
$$
\Delta^{CIC}_{\theta} = \Delta^{QTT}_{\theta,1} - \Delta^{QTC}_{\theta',0}
$$
where:
- $\Delta^{QTT}_{\theta,1}$ represents the change over time at quantile $\theta$ for the treated group ($D=1$).
- $\Delta^{QTC}_{\theta',0}$ represents the change over time at quantile $\theta'$ for the control group ($D=0$).
- The quantile $\theta'$ is selected to match the value of $y$ at quantile $\theta$ in the treated group's period 0 distribution.
------------------------------------------------------------------------
**Marketing Example**
Suppose a company introduces a new online marketing strategy aimed at improving customer retention rates. The goal is to analyze how this strategy affects retention at different quantiles of the customer base.
1. **QTT Interpretation:**
- Instead of looking at the average effect of the marketing strategy, CiC allows the company to examine how retention rates change across different quantiles (e.g., low vs. high-retention customers).
2. **Rank Preservation Assumption:**
- This approach assumes that customers' rank in the retention distribution remains unchanged, regardless of whether they received the new strategy.
3. **Counterfactual Distribution:**
- CiC helps estimate how retention rates would have evolved without the new strategy, by comparing trends in the control group.
------------------------------------------------------------------------
## Application
### ECIC package
```{r}
library(ecic)
data(dat, package = "ecic")
mod =
ecic(
yvar = lemp, # dependent variable
gvar = first.treat, # group indicator
tvar = year, # time indicator
ivar = countyreal, # unit ID
dat = dat, # dataset
boot = "weighted", # bootstrap proceduce ("no", "normal", or "weighted")
nReps = 3 # number of bootstrap runs
)
mod_res <- summary(mod)
mod_res
ecic_plot(mod_res)
```
### QTE package
```{r}
library(qte)
data(lalonde)
# randomized setting
# qte is identical to qtet
jt.rand <-
ci.qtet(
re78 ~ treat,
data = lalonde.exp,
iters = 10
)
summary(jt.rand)
ggqte(jt.rand)
```
```{r}
# conditional independence assumption (CIA)
jt.cia <- ci.qte(
re78 ~ treat,
xformla = ~ age + education,
data = lalonde.psid,
iters = 10
)
summary(jt.cia)
ggqte(jt.cia)
jt.ciat <- ci.qtet(
re78 ~ treat,
xformla = ~ age + education,
data = lalonde.psid,
iters = 10
)
summary(jt.ciat)
ggqte(jt.ciat)
```
- **QTE** compares quantiles of the entire population under treatment and control, whereas **QTET** compares quantiles within the treated group itself. This difference means that QTE reflects the overall population-level impact, while QTET focuses on the treated group's specific impact.
- **CIA** enables identification of both QTE and QTET, but since QTET is conditional on treatment, it might reflect different effects than QTE, especially when the treatment effect is heterogeneous across different subpopulations. For example, the QTE could show a more generalized effect across all individuals, while the QTET may reveal stronger or weaker effects for the subgroup that actually received the treatment.
These are DID-like models
1. With the distributional difference-in-differences assumption [@fan2012partial, @callaway2019quantile], which is an extension of the parallel trends assumption, we can estimate QTET.
```{r}
# distributional DiD assumption
jt.pqtet <- panel.qtet(
re ~ treat,
t = 1978,
tmin1 = 1975,
tmin2 = 1974,
tname = "year",
idname = "id",
data = lalonde.psid.panel,
iters = 10
)
summary(jt.pqtet)
ggqte(jt.pqtet)
```
2. With 2 periods, the distributional DiD assumption can partially identify QTET with bounds [@fan2012partial]
```{r}
res_bound <-
bounds(
re ~ treat,
t = 1978,
tmin1 = 1975,
data = lalonde.psid.panel,
idname = "id",
tname = "year"
)
summary(res_bound)
plot(res_bound)
```
3. With a restrictive assumption that difference in the quantiles of the distribution of potential outcomes for the treated and untreated groups be the same for all values of quantiles, we can have the mean DiD model
```{r}
jt.mdid <- ddid2(
re ~ treat,
t = 1978,
tmin1 = 1975,
tname = "year",
idname = "id",
data = lalonde.psid.panel,
iters = 10
)
summary(jt.mdid)
plot(jt.mdid)
```
On top of the distributional DiD assumption, we need **copula stability** assumption (i.e., If, before the treatment, the units with the highest outcomes were improving the most, we would expect to see them improving the most in the current period too.) for these models:
| **Aspect** | **QDiD** | **CiC** |
|---------------------------------|--------------------------------|----------------------------------|
| **Treatment of Time and Group** | Symmetric | Asymmetric |
| **QTET Computation** | Not inherently scale-invariant | Outcome Variable Scale-Invariant |
```{r, eval = FALSE}
jt.qdid <- QDiD(
re ~ treat,
t = 1978,
tmin1 = 1975,
tname = "year",
idname = "id",
data = lalonde.psid.panel,
iters = 10,
panel = T
)
jt.cic <- CiC(
re ~ treat,
t = 1978,
tmin1 = 1975,
tname = "year",
idname = "id",
data = lalonde.psid.panel,
iters = 10,
panel = T
)
```
------------------------------------------------------------------------
## CiC vs. QDiD: A More Detailed Contrast
CiC and QDiD both deliver quantile treatment effects in panel settings, but they rest on *different* identifying assumptions and answer *different* counterfactual questions. The distinction matters in applied work:
| **Aspect** | **QDiD (Quantile DiD)** | **CiC (Athey-Imbens)** |
|-----------------------------------|-----------------------------|-----------------------------|
| **Target estimand** | QTT at each quantile $\theta$ | QTT at each quantile $\theta$ |
| **Identifying assumption** | Differences in quantiles of untreated potential outcomes are constant across groups (a distributional parallel-trends form) | Rank invariance / rank similarity: an individual's rank in the untreated-outcome distribution is stable across groups and over time |
| **Treatment of time vs. group** | Symmetric (the roles of the two dimensions are interchangeable) | Asymmetric (explicit monotone production function in an unobserved scalar) |
| **Scale-invariance** | Not invariant to monotone outcome transforms; results depend on whether you use $Y$, $\log Y$, or $\sqrt{Y}$ | Invariant to monotone transformations of the outcome (a major advantage in applied work) |
| **Additional structure** | Requires a copula-stability assumption (the dependence between outcome ranks across periods is stable) | Requires that the distribution of the unobserved heterogeneity in the treated group is contained in that of the control |
| **Interpretation of heterogeneity** | Captures differences in quantile shifts | Captures shifts in the latent outcome-generating function |
Which to pick? CiC is the natural choice when three things hold: the outcome can reasonably be modeled as a monotone function of an unobserved scalar (productivity → wages is the canonical example), scale-invariance matters (you do not want results to flip when you log the outcome), and the treated group's pre-treatment support is contained in the control group's. QDiD is preferable when the distributional parallel-trends assumption is defensible (pre-treatment quantiles for treated and control track each other closely) and the outcome has a natural scale that need not be robust to monotone reparameterization.
When feasible, report both estimates alongside the standard DiD point estimate. Concordance across CiC, QDiD, and DiD increases credibility; divergence is a signal that distributional heterogeneity is doing real work in the data and deserves explicit discussion.
------------------------------------------------------------------------
## Practical Guidance on CiC
CiC becomes interesting in applications where the whole distribution of outcomes, not just the mean, carries policy weight. Income support programs often fit this description, because the effect at the bottom of the distribution is more important to a welfare analyst than the effect at the median. Job-training programs similarly can concentrate their gains in the middle of the ability distribution, with little or no effect at the tails. Marketing interventions where response is concentrated in a heavy upper tail (big spenders reacting strongly to a price promotion) are another case where the ATT masks the substantive story.
Before reaching for CiC, check three things. First, is the underlying outcome plausibly a monotone function of an unobserved scalar (ability, latent demand, willingness-to-pay)? The Athey-Imbens derivation relies on exactly that production-function structure. Second, is the treated group's pre-treatment outcome support contained inside the control group's support? If not, some quantiles are not identified and the estimator extrapolates. Third, will scale-invariance buy you something? CiC's main operational advantage over QDiD is that its output does not change if you log, square-root, or otherwise monotonically reparameterize the outcome, a useful feature when reviewers push back on functional-form choices.
The single strongest assumption is rank invariance: an individual's position in the untreated outcome distribution would have been the same in the post-period as in the pre-period, had they not been treated. It is an assumption that needs to be argued in context, not asserted from a template. In some settings (short panels, relatively stable populations) it is plausible; in others (long panels, high mobility across the distribution) it is hard to defend.
Two practical limitations to keep in mind. Confidence intervals come from the bootstrap and are often wide at extreme quantiles where density is low, do not chase statistical significance into the tails of a thin sample. And CiC identifies the marginal distribution of potential outcomes, not individual-level effects; a headline of the form "the treatment raised the 90th percentile by $X$" should not be read as "the 90th-percentile units gained $X$ from the treatment."
A complete CiC writeup has four elements: a plot of estimated QTT across quantiles with bootstrap bands, the corresponding DiD/ATT for comparison, overlap diagnostics showing pre-treatment outcome densities for treated and control, and, wherever feasible, both CiC and QDiD estimates side-by-side. Concordance across estimators builds credibility; divergence is itself a finding worth discussing.