Is there any work being done to implement the composition change robust DiD method for cross-sectional data proposed in Sant'Anna and Xu (2026) in STATA? I know there is an alpha release R-package.
As I understand the paper, a simplified parametric approximation to the point-estimation logic for a two-group, two-period application might look something like the following. Here, D indicates membership in the treated group, T indicates the post-treatment period, y is the outcome, and x1 x2 x3 are pre-treatment covariates.
(Disclosure: code is courtesy of ChatGPT with instructions.)
This obviously will not produce any standard errors.
I can use R if necessary, but am hoping someone might be working on a STATA implementation.
A couple of more substantive questions:
1. Is there any theoretical reason the estimator could not be extended to multiple post-treatment periods by using the same sequence of separate 2x2 comparisons that underlies standard CSDID? Could one estimate a separate composition robust ATT for each post-treatment period, with the treated observations in that period defining the target population? In my application, there is no staggered treatment, so I do not see any clear reason why this cannot be done.
Has there been any work on such a multi-period extension, and on how/whether the multiple ATTs could be aggregated?
2. I cannot go into great detail, but in my application there are several pre-treatment cohorts and multiple post-treatment cohorts, and there is composition variation across the several pre-treatment cohorts, especially for the untreated. Would it be theoretically valid to pool all of the pre-treatment cohorts together in the calculation of the ATT for each separate post-treatment period in order to expand the pre-treatment sample size? I realize this may be difficult to determine without more context.
As I understand the paper, a simplified parametric approximation to the point-estimation logic for a two-group, two-period application might look something like the following. Here, D indicates membership in the treated group, T indicates the post-treatment period, y is the outcome, and x1 x2 x3 are pre-treatment covariates.
Code:
preserve keep if inlist(D,0,1) & inlist(T,0,1) gen byte cell = . replace cell = 0 if D==0 & T==0 replace cell = 1 if D==0 & T==1 replace cell = 2 if D==1 & T==0 replace cell = 3 if D==1 & T==1 mlogit cell x1 x2 x3, baseoutcome(0) predict double p00, pr outcome(0) predict double p01, pr outcome(1) predict double p10, pr outcome(2) predict double p11, pr outcome(3) reg y x1 x2 x3 if D==1 & T==0 predict double m10, xb reg y x1 x2 x3 if D==0 & T==1 predict double m01, xb reg y x1 x2 x3 if D==0 & T==0 predict double m00, xb gen double I11 = D==1 & T==1 quietly summarize I11, meanonly scalar den11 = r(mean) gen double w11 = I11/den11 gen double q10 = (D==1 & T==0)*(p11/p10) quietly summarize q10, meanonly scalar den10 = r(mean) gen double w10 = q10/den10 gen double q01 = (D==0 & T==1)*(p11/p01) quietly summarize q01, meanonly scalar den01 = r(mean) gen double w01 = q01/den01 gen double q00 = (D==0 & T==0)*(p11/p00) quietly summarize q00, meanonly scalar den00 = r(mean) gen double w00 = q00/den00 capture drop tau_yx dr_score gen double tau_yx = y - m10 - m01 + m00 gen double dr_score = w11*tau_yx - w10*(y-m10) - w01*(y-m01) + w00*(y-m00) quietly summarize dr_score, meanonly scalar ATT_SX = r(mean) display "Approximate composition-robust ATT = " %9.6f ATT_SX restore
This obviously will not produce any standard errors.
I can use R if necessary, but am hoping someone might be working on a STATA implementation.
A couple of more substantive questions:
1. Is there any theoretical reason the estimator could not be extended to multiple post-treatment periods by using the same sequence of separate 2x2 comparisons that underlies standard CSDID? Could one estimate a separate composition robust ATT for each post-treatment period, with the treated observations in that period defining the target population? In my application, there is no staggered treatment, so I do not see any clear reason why this cannot be done.
Has there been any work on such a multi-period extension, and on how/whether the multiple ATTs could be aggregated?
2. I cannot go into great detail, but in my application there are several pre-treatment cohorts and multiple post-treatment cohorts, and there is composition variation across the several pre-treatment cohorts, especially for the untreated. Would it be theoretically valid to pool all of the pre-treatment cohorts together in the calculation of the ATT for each separate post-treatment period in order to expand the pre-treatment sample size? I realize this may be difficult to determine without more context.
