Skip to content

Commit c8cd414

Browse files
igerberclaude
andcommitted
Address PR #207 review feedback: fix misleading control unit label and panel=FALSE golden values
- Rename summary label "Control units:" → "Never-treated units:" in CallawaySantAnnaResults to avoid confusion when not_yet_treated control group has zero never-treated units - Clarify n_control_units docstring to note it excludes not-yet-treated dynamic controls - Remove panel=FALSE from scenarios 4 and 5 in R golden value generator so golden values match the Python panel estimator (previously overstated validation) - Regenerate csdid_golden_values.json Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 07d4741 commit c8cd414

3 files changed

Lines changed: 17 additions & 19 deletions

File tree

benchmarks/R/generate_csdid_test_values.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ data4 <- build_sim_dataset(sp4)
169169

170170
res4 <- att_gt(yname = "Y", xformla = ~X, data = data4, tname = "period",
171171
idname = "id", gname = "G", est_method = "reg",
172-
bstrap = FALSE, cband = FALSE, panel = FALSE)
172+
bstrap = FALSE, cband = FALSE)
173173
agg4_dynamic <- aggte(res4, type = "dynamic", bstrap = FALSE, cband = FALSE)
174174

175175
scenarios$dynamic_effects <- list(
176176
data = export_data(data4),
177177
params = list(est_method = "reg", control_group = "nevertreated",
178-
xformla = "~X", base_period = "varying", panel = FALSE),
178+
xformla = "~X", base_period = "varying"),
179179
results = list(
180180
group_time = extract_gt(res4),
181181
dynamic = extract_agg(agg4_dynamic)
@@ -198,15 +198,15 @@ data5 <- subset(data5, period %in% keep.periods)
198198

199199
res5 <- att_gt(yname = "Y", xformla = ~X, data = data5, tname = "period",
200200
idname = "id", gname = "G", est_method = "reg",
201-
bstrap = FALSE, cband = FALSE, panel = FALSE)
201+
bstrap = FALSE, cband = FALSE)
202202
agg5_dynamic <- aggte(res5, type = "dynamic", bstrap = FALSE, cband = FALSE)
203203
agg5_balance <- aggte(res5, type = "dynamic", balance_e = 0,
204204
bstrap = FALSE, cband = FALSE)
205205

206206
scenarios$non_consecutive_periods <- list(
207207
data = export_data(data5),
208208
params = list(est_method = "reg", control_group = "nevertreated",
209-
xformla = "~X", base_period = "varying", panel = FALSE),
209+
xformla = "~X", base_period = "varying"),
210210
results = list(
211211
group_time = extract_gt(res5),
212212
dynamic = extract_agg(agg5_dynamic),

benchmarks/data/csdid_golden_values.json

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,21 +155,20 @@
155155
"est_method": "reg",
156156
"control_group": "nevertreated",
157157
"xformla": "~X",
158-
"base_period": "varying",
159-
"panel": false
158+
"base_period": "varying"
160159
},
161160
"results": {
162161
"group_time": {
163162
"group": [2, 2, 2, 3, 3, 3, 4, 4, 4],
164163
"time": [2, 3, 4, 2, 3, 4, 2, 3, 4],
165-
"att": [1.1619345587, 1.9806271422, 3.1291417943, -0.11164281617, 0.8368911508, 2.1879948095, -0.10395702362, -0.00099808793357, 0.92702821049],
166-
"se": [0.37188664974, 0.41090066647, 0.46080728316, 0.45290896601, 0.55834155256, 0.61699201548, 0.40706432128, 0.49486177347, 0.59510165336]
164+
"att": [1.1619345587, 1.9806271422, 3.1291417943, -0.11164281617, 0.8368911508, 2.1879948095, -0.10395702362, -0.00099808793362, 0.92702821049],
165+
"se": [0.19192101496, 0.21040775677, 0.20357402241, 0.22247872369, 0.21167719772, 0.22518098115, 0.20616133048, 0.20504607933, 0.21443054603]
167166
},
168167
"dynamic": {
169168
"overall_att": 2.060851975,
170-
"overall_se": 0.27407895206,
169+
"overall_se": 0.12749075561,
171170
"att": [-0.10395702362, -0.044806660534, 0.97874816264, 2.074665968, 3.1291417943],
172-
"se": [0.40706432128, 0.32905421365, 0.29393486639, 0.35874990004, 0.46080728316],
171+
"se": [0.20616133048, 0.13857947004, 0.10343596176, 0.15426829989, 0.20357402241],
173172
"egt": [-2, -1, 0, 1, 2]
174173
}
175174
}
@@ -187,28 +186,27 @@
187186
"est_method": "reg",
188187
"control_group": "nevertreated",
189188
"xformla": "~X",
190-
"base_period": "varying",
191-
"panel": false
189+
"base_period": "varying"
192190
},
193191
"results": {
194192
"group_time": {
195193
"group": [2, 2, 2, 5, 5, 5, 7, 7, 7],
196194
"time": [2, 5, 7, 2, 5, 7, 2, 5, 7],
197195
"att": [0.99169165575, 3.9498224909, 5.5125753853, 0.0060151208735, 0.76227117049, 2.8066993777, -0.18717828366, -0.29655357309, 0.79303584629],
198-
"se": [0.68280178613, 0.84102367846, 1.050254212, 0.67004481625, 0.85687016966, 0.95893447545, 0.62746934691, 0.79798902953, 1.2013519687]
196+
"se": [0.28333148004, 0.27124277852, 0.2649377156, 0.27000914872, 0.26082165208, 0.24574534739, 0.29030567969, 0.28842055307, 0.27221422428]
199197
},
200198
"dynamic": {
201199
"overall_att": 3.2780871625,
202-
"overall_se": 0.54064463051,
200+
"overall_se": 0.15246801609,
203201
"att": [-0.18717828366, 0.0060151208735, -0.29655357309, 0.8432513962, 2.8066993777, 3.9498224909, 5.5125753853],
204-
"se": [0.62746934691, 0.67004481625, 0.79798902953, 0.52758456271, 0.95893447545, 0.84102367846, 1.050254212],
202+
"se": [0.29030567969, 0.27000914872, 0.28842055307, 0.12222233584, 0.24574534739, 0.27124277852, 0.2649377156],
205203
"egt": [-5, -3, -2, 0, 2, 3, 5]
206204
},
207205
"dynamic_balance_e0": {
208206
"overall_att": 0.8432513962,
209-
"overall_se": 0.52758456271,
207+
"overall_se": 0.12222233584,
210208
"att": [-0.18717828366, 0.0060151208735, -0.29655357309, 0.8432513962],
211-
"se": [0.62746934691, 0.67004481625, 0.79798902953, 0.52758456271],
209+
"se": [0.29030567969, 0.27000914872, 0.28842055307, 0.12222233584],
212210
"egt": [-5, -3, -2, 0]
213211
}
214212
}

diff_diff/staggered_results.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class CallawaySantAnnaResults:
8888
n_treated_units : int
8989
Number of ever-treated units.
9090
n_control_units : int
91-
Number of never-treated units.
91+
Number of never-treated units (excludes not-yet-treated dynamic controls).
9292
event_study_effects : dict, optional
9393
Effects aggregated by relative time (event study).
9494
group_effects : dict, optional
@@ -152,7 +152,7 @@ def summary(self, alpha: Optional[float] = None) -> str:
152152
"",
153153
f"{'Total observations:':<30} {self.n_obs:>10}",
154154
f"{'Treated units:':<30} {self.n_treated_units:>10}",
155-
f"{'Control units:':<30} {self.n_control_units:>10}",
155+
f"{'Never-treated units:':<30} {self.n_control_units:>10}",
156156
f"{'Treatment cohorts:':<30} {len(self.groups):>10}",
157157
f"{'Time periods:':<30} {len(self.time_periods):>10}",
158158
f"{'Control group:':<30} {self.control_group:>10}",

0 commit comments

Comments
 (0)