Appendix A — Technical details (optional)
The main note gives the argument. Open a section below for definitions, proofs, or the lab’s calculations. The notation comes from de Chaisemartin and D’Haultfœuille (2020) and Goodman-Bacon (2021). Algebraic simplifications and numerical illustrations are identified as such.
Assumptions and notation in the two papers
A.1 Foundations
Potential outcomes and treatment effects
Follow dCDH’s Section I. \(N_{g,t}\) is the number of observations in group \(g\) and period \(t\). \(D_{g,t}\) is the group’s treatment status. Treatment is the same for all units in a cell, which the authors call a sharp design. The observed and potential cell means are \(Y_{g,t}\), \(Y_{g,t}(0)\), and \(Y_{g,t}(1)\). Define
\[ \Delta_{g,t}=Y_{g,t}(1)-Y_{g,t}(0), \qquad Y_{g,t}=Y_{g,t}(0)+D_{g,t}\Delta_{g,t}. \tag{A.1}\]
dCDH calls \(\Delta_{g,t}\) the cell ATE. In a treated cell, all units receive treatment, so this also averages the effects on the treated units in that cell.
Goodman-Bacon’s Section 3 instead writes \(Y_{it}(k)\) for the potential outcome when treatment starts at \(k\), and \(Y_{it}(0)\) for the untreated outcome. Treatment has no effect before \(k\). For this note’s staggered design, dCDH’s treated outcome is understood along the unit’s actual treatment path. It does not mean switching treatment on for just one period. This correspondence allows effects to depend on time since treatment.
The assumptions used here
The note and lab restrict attention to a balanced panel with fixed group sizes. Every group is observed at every date. Treatment is binary, starts after period 1, and stays on. Some groups may remain untreated. There are no additional covariates. These restrictions are narrower than dCDH’s general setting.
Condition on the vector \(\mathbf D\) of cell treatments. For the causal calculations, assume that
\[ \mathbb E[Y_{g,t}(0)-Y_{g,t-1}(0)\mid\mathbf D] \quad\text{is the same for all }g. \tag{A.2}\]
This is common trends conditional on the treatment design. dCDH derives the corresponding restriction from independent groups, strong exogeneity, and common trends. We impose the conditional restriction directly. We also maintain no anticipation and no effects of other units’ treatment. The restriction concerns untreated outcomes, not changes in treatment effects.
Let \(\widehat\beta_{fe}\) be the treatment coefficient in the regression of \(Y_{i,g,t}\) on treatment and group and period fixed effects. dCDH writes \(\beta_{fe}=\mathbb E[\widehat\beta_{fe}]\). Its conditional notation is
\[ \widetilde\beta_{fe}=\mathbb E[\widehat\beta_{fe}\mid\mathbf D], \qquad \widetilde\Delta_{g,t}=\mathbb E[\Delta_{g,t}\mid\mathbf D]. \tag{A.3}\]
The ATT across treated observations
With \(N_1=\sum_{g,t}N_{g,t}D_{g,t}\), dCDH defines
\[ \Delta^{TR}=\sum_{(g,t):D_{g,t}=1}\frac{N_{g,t}}{N_1}\Delta_{g,t}, \qquad \widetilde\Delta^{TR}=\mathbb E[\Delta^{TR}\mid\mathbf D]. \tag{A.4}\]
The paper calls \(\delta^{TR}=\mathbb E[\Delta^{TR}]\) the ATT and uses \(\widetilde\Delta^{TR}\) for its conditional counterpart. The main note holds the treatment design fixed and therefore uses the latter. In a panel, \(N_1\) counts treated observations across dates. It is not the number of distinct people ever treated.
Notation correspondence
| Meaning | dCDH (2020) | Goodman-Bacon (2021) |
|---|---|---|
| Sample TWFE treatment coefficient | \(\widehat\beta_{fe}\) | \(\widehat\beta^{DD}\) |
| Group | \(g\), any group sharing treatment within a cell | \(k,\ell,U\), groups defined by treatment date |
| Expected effect at a treated date | \(\widetilde\Delta_{g,t}\) | \(ATT_k(t)\) for timing group \(g=k\) |
| Weight multiplying a cell effect | \(W_{g,t}=(N_{g,t}/N_1)w_{g,t}\) | Obtained by expanding weighted DiDs |
| Weight multiplying a \(2\times2\) DiD | No separate notation needed here | \(s_{kU},s^k_{k\ell},s^\ell_{k\ell}\) |
| Treatment residual | \(\varepsilon_{g,t}\) | \(\widetilde D_{it}\) |
The coefficient equality applies to this note’s balanced panel without covariates. Units in a group have identical treatment paths, so using unit or group fixed effects gives the same treatment residual and treatment coefficient. The cell-effect correspondence holds with the treatment groups and design fixed. Goodman-Bacon defines \(ATT_k(\tau)\) within a timing group. We use \(t\) for this date throughout. dCDH makes the conditioning on \(\mathbf D\) explicit.
The papers also use \(N\) differently. dCDH counts observations across all dates; Goodman-Bacon counts distinct panel units. We avoid using \(N\) in the combined formulas below. Goodman-Bacon’s \(n_k\) is a share, not a unit count.
Notation in the July 2024 notes
The original Chinese notes used simpler symbols for the same two-group example.
| July 2024 notes | This note |
|---|---|
| Groups \(G_1\), \(G_2\) | Timing groups \(k\), \(\ell\) |
| Cell effects \(\beta_{12},\beta_{13},\beta_{23}\) | \(\widetilde\Delta_{k,2},\widetilde\Delta_{k,3},\widetilde\Delta_{\ell,3}\) |
| Comparisons \(DD_1\), \(DD_2\) | \(DID_1\), \(DID_2\) |
| TWFE coefficient \(\beta^{DD}\) | \(\widehat\beta_{fe}\), or \(\widetilde\beta_{fe}\) in expectation |
| Equations (6) and (8) | First and last lines of Equation 6 |
The notes wrote both cell effects and the regression coefficient with \(\beta\). Here each effect has its own symbol, so that a treatment effect and a regression coefficient are not confused.
Regression derivation and the two-group proof
A.2 The two general decompositions
Goodman-Bacon’s sample identity
Theorem 1 and equation (10a) of Goodman-Bacon (2021) give
\[ \begin{aligned} \widehat\beta^{DD} ={}&\sum_{k\ne U}s_{kU}\widehat\beta^{2\times2}_{kU}\\ &+\sum_{k\ne U}\sum_{\ell>k} \left[s^k_{k\ell}\widehat\beta^{2\times2,k}_{k\ell} +s^\ell_{k\ell}\widehat\beta^{2\times2,\ell}_{k\ell}\right]. \end{aligned} \tag{A.5}\]
The three terms correspond to treated versus never treated, early versus late, and late versus early. A timing group includes all units with the same treatment date. \(U\) contains never-treated units. The weights are positive for comparisons present in the design and sum to one. If \(U\) is absent, omit its terms. This identity does not require assumptions on potential outcomes.
dCDH’s treatment-effect weights
dCDH’s Section II.A defines \(\varepsilon_{g,t}\) as the residual from regressing treatment on group and period fixed effects. With time-constant group sizes,
\[ \varepsilon_{g,t} =D_{g,t}-D_{g,.}-D_{.,t}+D_{.,.}. \tag{A.6}\]
Here \(D_{g,.}\) averages treatment over a group’s periods. \(D_{.,t}\) averages across units at a date. \(D_{.,.}\) is the overall mean. These are dCDH’s mean conventions. For a treated cell,
\[ \varepsilon_{g,t}<0 \quad\Longleftrightarrow\quad D_{g,.}+D_{.,t}>1+D_{.,.}. \tag{A.7}\]
The residual is orthogonal to the fixed effects, so
\[ \sum_{g,t}N_{g,t}\varepsilon_{g,t}D_{g,t} =\sum_{g,t}N_{g,t}\varepsilon_{g,t}^{\,2}>0. \tag{A.8}\]
Strict positivity requires treatment variation after removing the fixed effects. If everyone starts treatment at the same date, the period effects absorb treatment.
The Frisch–Waugh–Lovell theorem gives the sample identity
\[ \widehat\beta_{fe} =\frac{\sum_{g,t}N_{g,t}\varepsilon_{g,t}Y_{g,t}} {\sum_{g,t}N_{g,t}\varepsilon_{g,t}^{\,2}}. \tag{A.9}\]
Under the conditional common-trends restriction, the expected untreated component contributes zero to the numerator. Therefore,
\[ \widetilde\beta_{fe} =\sum_{(g,t):D_{g,t}=1}W_{g,t}\widetilde\Delta_{g,t}, \qquad W_{g,t}=\frac{N_{g,t}\varepsilon_{g,t}} {\sum_{g,t}N_{g,t}\varepsilon_{g,t}^{\,2}}. \tag{A.10}\]
In Theorem 1 the authors separate this weight into two factors:
\[ w_{g,t} =\frac{\varepsilon_{g,t}} {\sum_{(g,t):D_{g,t}=1}(N_{g,t}/N_1)\varepsilon_{g,t}}, \qquad W_{g,t}=\frac{N_{g,t}}{N_1}w_{g,t}. \tag{A.11}\]
Thus \(\sum_{D_{g,t}=1}W_{g,t}=1\). In general \(\sum_{D_{g,t}=1}w_{g,t}\) is not one. Both weights have the sign of \(\varepsilon_{g,t}\). The uppercase notation is from dCDH’s introductory equation (1); the product above follows from its Theorem 1.
The sample coefficient need not equal a weighted sum of expected effects in a realized dataset. The difference is the regression’s outcome noise. The lab sets that noise to zero.
When does TWFE equal the ATT?
Subtracting the two averages yields
\[ \widetilde\beta_{fe}-\widetilde\Delta^{TR} =\sum_{(g,t):D_{g,t}=1}\frac{N_{g,t}}{N_1} (w_{g,t}-1)\widetilde\Delta_{g,t}. \tag{A.12}\]
Because the weighted mean of \(w_{g,t}\) is one, we may replace \(\widetilde\Delta_{g,t}\) on the right by \(\widetilde\Delta_{g,t}-\widetilde\Delta^{TR}\). This expresses the difference as a weighted covariance. If it is zero for the fixed design, the two conditional averages agree.
In the two-group example of the main note, the difference is
\[ \widetilde\beta_{fe}-\widetilde\Delta^{TR} =\frac{4\widetilde\Delta_{k,2}-5\widetilde\Delta_{k,3} +\widetilde\Delta_{\ell,3}}6. \tag{A.13}\]
At \((1,2,6)\) the numerator is \(4-10+6=0\), so TWFE equals the ATT although the early effect grows. At \((1,1,3)\) it is \(2\), giving the gap \(1/3\) between TWFE \(2\) and ATT \(5/3\). Equality at one set of effects says nothing about another.
dCDH’s Assumption 7 imposes the corresponding zero-covariance condition in expectation; Corollary 2 then gives \(\beta_{fe}=\delta^{TR}\). This is a sufficient condition that allows effects to change over time.
Direct verification of the example
With rows \((k,\ell)\) and columns \((1,2,3)\),
\[ D=\begin{pmatrix}0&1&1\\0&0&1\end{pmatrix}, \qquad \varepsilon=\frac16\begin{pmatrix}-1&2&-1\\1&-2&1\end{pmatrix}. \tag{A.14}\]
For equal group sizes, the coefficients on the six observed means in Equation A.9 are \(3\varepsilon_{g,t}\). Hence
\[ \begin{aligned} \widehat\beta_{fe} ={}&-\tfrac12Y_{k,1}+Y_{k,2}-\tfrac12Y_{k,3} +\tfrac12Y_{\ell,1}-Y_{\ell,2}+\tfrac12Y_{\ell,3}\\ ={}&\tfrac12[(Y_{k,2}-Y_{k,1})-(Y_{\ell,2}-Y_{\ell,1})]\\ &+\tfrac12[(Y_{\ell,3}-Y_{\ell,2})-(Y_{k,3}-Y_{k,2})]. \end{aligned} \]
After taking expectations and applying the outcome assumptions, only the three treated effects remain. The following table shows their coefficients from each weighted comparison.
| Effect | Early versus late, weight \(1/2\) | Late versus early, weight \(1/2\) | Sum: \(W_{g,t}\) |
|---|---|---|---|
| \(\widetilde\Delta_{k,2}\) | \(1/2\) | \(1/2\) | \(1\) |
| \(\widetilde\Delta_{k,3}\) | \(0\) | \(-1/2\) | \(-1/2\) |
| \(\widetilde\Delta_{\ell,3}\) | \(0\) | \(1/2\) | \(1/2\) |
Each cell is one-third of the treated observations. Therefore dCDH’s lowercase weights are \((3,-3/2,3/2)\), while the coefficients multiplying the effects are \((1,-1/2,1/2)\). Negative coefficients on untreated outcome means are part of ordinary differencing; they are not negative weights on treatment effects.
Multi-group calculations and verification
A.3 Formulas used in the lab
Timing groups and time windows
Pool groups sharing a treatment date, using their unit counts to average outcomes. Follow Goodman-Bacon: \(k<\ell\) are two treatment dates, and \(n_k,n_\ell\) are their shares of panel units. For a timing group that is a single lab group, \(n_k=N_{k,t}/\sum_gN_{g,t}\) at any date.
The time windows in equations (10b)–(10d) are
\[ \begin{aligned} \mathrm{PRE}(k)&=\{1,\ldots,k-1\},\\ \mathrm{MID}(k,\ell)&=\{k,\ldots,\ell-1\},\\ \mathrm{POST}(\ell)&=\{\ell,\ldots,T\}. \end{aligned} \tag{A.15}\]
Early versus late compares PRE with MID. Late versus early compares MID with POST. For treated versus never treated, use the treated group’s own PRE and POST. Every window mean averages all dates in that window.
Comparison weights
Goodman-Bacon writes \(\bar D_k\) for the fraction of periods timing group \(k\) is treated. Its overall residual treatment variance is \(\widehat V^D\). In terms of dCDH’s cell counts and residuals,
\[ \bar D_k=\frac{T-k+1}{T}, \qquad \widehat V^D =\frac{\sum_{g,t}N_{g,t}\varepsilon_{g,t}^{\,2}} {\sum_{g,t}N_{g,t}}. \tag{A.16}\]
Canceling factors in Goodman-Bacon’s equations (10e)–(10g) gives
\[ s_{kU}=\frac{n_kn_U\bar D_k(1-\bar D_k)}{\widehat V^D}, \tag{A.17}\]
\[ \begin{aligned} s^k_{k\ell} &=\frac{n_kn_\ell(\bar D_k-\bar D_\ell)(1-\bar D_k)}{\widehat V^D},\\ s^\ell_{k\ell} &=\frac{n_kn_\ell\bar D_\ell(\bar D_k-\bar D_\ell)}{\widehat V^D}. \end{aligned} \tag{A.18}\]
These are algebraic simplifications of the paper’s weights, with the same notation. They equal the values shown by the lab. The weights of all comparisons present sum to one when \(\widehat V^D>0\).
From a comparison to a cell effect
Within a DiD, a treatment group’s post mean has sign \(+\) and its pre mean has sign \(-\). The control group’s signs are reversed. Divide by the number of periods in each window when expanding a window mean. If a timing group pools several lab groups, also multiply each group’s mean by its share of that timing group’s units. Finally multiply by the comparison weight.
The inspection tables display the resulting coefficient on each treated cell’s effect. Adding that cell’s coefficients over all comparisons gives \(W_{g,t}\) in Equation A.10. These entries are coefficients from the expansion, rather than separate Goodman-Bacon weights. The two-group table gives a complete example.
Verification
The calculation engine was checked against a separate weighted least-squares regression of cell outcomes on treatment and fixed effects. Cell weights are \(N_{g,t}\). The checks cover unequal sizes, shared treatment dates, never-treated groups, changing effects, and individual effect edits.
Across 684 estimable designs, the largest difference from the independent regression was below \(2\times10^{-12}\). The checks also verified both decompositions and each cell’s coefficient summed over comparisons. A further 24 designs with no residual treatment variation were correctly reported as unidentified.
In lab step 1, the note’s two-group example, the lab gives TWFE \(-1\), ATT \(7/3\), comparison weights \((1/2,1/2)\), and cell weights \(W=(1,-1/2,1/2)\). These checks concern the implementation. They do not test common trends in any application.
Where to find the results in the papers
A.4 Source guide and further reading
| Topic or notation | Source |
|---|---|
| \(Y_{g,t}\), \(\Delta_{g,t}\), \(N_{g,t}\), and the ATT | dCDH, Sections I and II.A |
| \(W_{g,t}\) | dCDH, introductory equation (1) |
| \(\varepsilon_{g,t}\), \(w_{g,t}\), and the effect decomposition | dCDH, Theorem 1 and its proof |
| Conditional \(\widetilde\beta_{fe}\), \(\widetilde\Delta_{g,t}\), \(\widetilde\Delta^{TR}\) | dCDH, Section II.B |
| Weights uncorrelated with effects | dCDH, Assumption 7 and Corollary 2 |
| Timing groups, PRE, MID, POST, and comparison weights | Goodman-Bacon, Section 2 and equations (10a)–(10g) |
| \(ATT_k(t)\) and effects averaged over windows | Goodman-Bacon, Section 3 and equation (12) |
| VWATT, VWCT, and \(\Delta ATT\) | Goodman-Bacon, equations (15)–(15c) |
| Constant effects within groups and the ATT distinction | Goodman-Bacon, Section 3.1.1 and equation (16) |
Goodman-Bacon’s \(\beta^{DD}\) in equation (15) is a probability limit. dCDH’s \(\widetilde\beta_{fe}\) is a conditional expectation. The note uses the latter for its finite-design calculations. It does not equate a finite-sample conditional expectation with an asymptotic limit. Both papers explain the same subtraction of changing effects in already-treated controls.
The lab reports the count of negative \(W_{g,t}\) and their sum. In the small example, one of three weights is negative and the negative weights sum to \(-1/2\). Neither number alone establishes a violation of common trends or gives the size of the treatment effects.
The term forbidden comparison, for a DiD that uses already-treated units as controls, comes from Borusyak et al. (2024).
The core argument uses the two papers above. The practical section of the main note points to the following estimators and survey. They introduce no additional notation into this note:
- Callaway and Sant’Anna (2021), Difference-in-Differences with Multiple Time Periods.
- Sun and Abraham (2021), Estimating Dynamic Treatment Effects in Event Studies with Heterogeneous Treatment Effects.
- Borusyak et al. (2024), Revisiting Event-Study Designs: Robust and Efficient Estimation.
- de Chaisemartin and D’Haultfœuille (2023), Two-Way Fixed Effects and Differences-in-Differences with Heterogeneous Treatment Effects: A Survey.