Skip to content

Commit 9ac5ca3

Browse files
igerberclaude
andcommitted
tutorial: make paired_power_tail self-contained (CI codex P3)
Compute the clean-tail boundary as max(cohorts) inside paired_power_tail instead of closing over the module-level tail_start (= max moderate cohorts). The committed moderate results are unchanged, but the helper no longer silently uses the wrong tail boundary if a reader reuses it with fast/slow/custom cohorts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 39a8169 commit 9ac5ca3

1 file changed

Lines changed: 38 additions & 38 deletions

File tree

docs/tutorials/24_staggered_vs_collapsed_power.ipynb

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
"id": "0c4f03f8",
3838
"metadata": {
3939
"execution": {
40-
"iopub.execute_input": "2026-05-31T17:25:07.970044Z",
41-
"iopub.status.busy": "2026-05-31T17:25:07.969964Z",
42-
"iopub.status.idle": "2026-05-31T17:25:09.056641Z",
43-
"shell.execute_reply": "2026-05-31T17:25:09.056344Z"
40+
"iopub.execute_input": "2026-05-31T17:34:22.452742Z",
41+
"iopub.status.busy": "2026-05-31T17:34:22.452638Z",
42+
"iopub.status.idle": "2026-05-31T17:34:23.450453Z",
43+
"shell.execute_reply": "2026-05-31T17:34:23.450121Z"
4444
}
4545
},
4646
"outputs": [],
@@ -134,10 +134,10 @@
134134
"id": "08de7530",
135135
"metadata": {
136136
"execution": {
137-
"iopub.execute_input": "2026-05-31T17:25:09.057951Z",
138-
"iopub.status.busy": "2026-05-31T17:25:09.057805Z",
139-
"iopub.status.idle": "2026-05-31T17:25:09.168258Z",
140-
"shell.execute_reply": "2026-05-31T17:25:09.168012Z"
137+
"iopub.execute_input": "2026-05-31T17:34:23.451750Z",
138+
"iopub.status.busy": "2026-05-31T17:34:23.451607Z",
139+
"iopub.status.idle": "2026-05-31T17:34:23.554530Z",
140+
"shell.execute_reply": "2026-05-31T17:34:23.554288Z"
141141
}
142142
},
143143
"outputs": [
@@ -296,10 +296,10 @@
296296
"id": "8496ad42",
297297
"metadata": {
298298
"execution": {
299-
"iopub.execute_input": "2026-05-31T17:25:09.169287Z",
300-
"iopub.status.busy": "2026-05-31T17:25:09.169199Z",
301-
"iopub.status.idle": "2026-05-31T17:25:09.191829Z",
302-
"shell.execute_reply": "2026-05-31T17:25:09.191562Z"
299+
"iopub.execute_input": "2026-05-31T17:34:23.555584Z",
300+
"iopub.status.busy": "2026-05-31T17:34:23.555499Z",
301+
"iopub.status.idle": "2026-05-31T17:34:23.577001Z",
302+
"shell.execute_reply": "2026-05-31T17:34:23.576754Z"
303303
}
304304
},
305305
"outputs": [
@@ -337,10 +337,10 @@
337337
"id": "77f02fec",
338338
"metadata": {
339339
"execution": {
340-
"iopub.execute_input": "2026-05-31T17:25:09.192880Z",
341-
"iopub.status.busy": "2026-05-31T17:25:09.192798Z",
342-
"iopub.status.idle": "2026-05-31T17:25:09.262241Z",
343-
"shell.execute_reply": "2026-05-31T17:25:09.261968Z"
340+
"iopub.execute_input": "2026-05-31T17:34:23.578028Z",
341+
"iopub.status.busy": "2026-05-31T17:34:23.577958Z",
342+
"iopub.status.idle": "2026-05-31T17:34:23.642154Z",
343+
"shell.execute_reply": "2026-05-31T17:34:23.641881Z"
344344
}
345345
},
346346
"outputs": [
@@ -395,10 +395,10 @@
395395
"id": "cd8bb89e",
396396
"metadata": {
397397
"execution": {
398-
"iopub.execute_input": "2026-05-31T17:25:09.263388Z",
399-
"iopub.status.busy": "2026-05-31T17:25:09.263296Z",
400-
"iopub.status.idle": "2026-05-31T17:25:18.140328Z",
401-
"shell.execute_reply": "2026-05-31T17:25:18.140055Z"
398+
"iopub.execute_input": "2026-05-31T17:34:23.643160Z",
399+
"iopub.status.busy": "2026-05-31T17:34:23.643090Z",
400+
"iopub.status.idle": "2026-05-31T17:34:32.168026Z",
401+
"shell.execute_reply": "2026-05-31T17:34:32.167759Z"
402402
}
403403
},
404404
"outputs": [
@@ -537,10 +537,10 @@
537537
"id": "823fbfb7",
538538
"metadata": {
539539
"execution": {
540-
"iopub.execute_input": "2026-05-31T17:25:18.141419Z",
541-
"iopub.status.busy": "2026-05-31T17:25:18.141329Z",
542-
"iopub.status.idle": "2026-05-31T17:25:21.129207Z",
543-
"shell.execute_reply": "2026-05-31T17:25:21.128906Z"
540+
"iopub.execute_input": "2026-05-31T17:34:32.169035Z",
541+
"iopub.status.busy": "2026-05-31T17:34:32.168955Z",
542+
"iopub.status.idle": "2026-05-31T17:34:35.071481Z",
543+
"shell.execute_reply": "2026-05-31T17:34:35.071164Z"
544544
}
545545
},
546546
"outputs": [
@@ -573,10 +573,10 @@
573573
"id": "5f8e0c4b",
574574
"metadata": {
575575
"execution": {
576-
"iopub.execute_input": "2026-05-31T17:25:21.130387Z",
577-
"iopub.status.busy": "2026-05-31T17:25:21.130295Z",
578-
"iopub.status.idle": "2026-05-31T17:26:13.586001Z",
579-
"shell.execute_reply": "2026-05-31T17:26:13.585671Z"
576+
"iopub.execute_input": "2026-05-31T17:34:35.072605Z",
577+
"iopub.status.busy": "2026-05-31T17:34:35.072530Z",
578+
"iopub.status.idle": "2026-05-31T17:35:26.085255Z",
579+
"shell.execute_reply": "2026-05-31T17:35:26.084962Z"
580580
}
581581
},
582582
"outputs": [
@@ -756,10 +756,10 @@
756756
"id": "9a902d30",
757757
"metadata": {
758758
"execution": {
759-
"iopub.execute_input": "2026-05-31T17:26:13.587561Z",
760-
"iopub.status.busy": "2026-05-31T17:26:13.587461Z",
761-
"iopub.status.idle": "2026-05-31T17:26:14.441020Z",
762-
"shell.execute_reply": "2026-05-31T17:26:14.440765Z"
759+
"iopub.execute_input": "2026-05-31T17:35:26.086344Z",
760+
"iopub.status.busy": "2026-05-31T17:35:26.086255Z",
761+
"iopub.status.idle": "2026-05-31T17:35:26.950218Z",
762+
"shell.execute_reply": "2026-05-31T17:35:26.949945Z"
763763
}
764764
},
765765
"outputs": [
@@ -803,10 +803,10 @@
803803
"id": "34cfb285",
804804
"metadata": {
805805
"execution": {
806-
"iopub.execute_input": "2026-05-31T17:26:14.442035Z",
807-
"iopub.status.busy": "2026-05-31T17:26:14.441954Z",
808-
"iopub.status.idle": "2026-05-31T17:26:32.648215Z",
809-
"shell.execute_reply": "2026-05-31T17:26:32.647808Z"
806+
"iopub.execute_input": "2026-05-31T17:35:26.951330Z",
807+
"iopub.status.busy": "2026-05-31T17:35:26.951248Z",
808+
"iopub.status.idle": "2026-05-31T17:35:45.177015Z",
809+
"shell.execute_reply": "2026-05-31T17:35:45.176708Z"
810810
}
811811
},
812812
"outputs": [
@@ -831,11 +831,11 @@
831831
"# ...and it's not just unbiased: under FLAT effects with a clean tail, the clean-tail 2x2\n",
832832
"# also detects a smaller lift than CS (it pools the whole tail into one tight contrast).\n",
833833
"def paired_power_tail(cohorts, lift, n_sims=250, seed0=4000):\n",
834-
" rs = min(cohorts)\n",
834+
" rs, ts = min(cohorts), max(cohorts) # clean tail starts after the last wave\n",
835835
" rej_tail, rej_cs = [], []\n",
836836
" for i in range(n_sims):\n",
837837
" p = make_panel(cohorts, lift, seed0 + i, growth=0.0) # flat effects\n",
838-
" rej_tail.append(fit_2x2(p, rs, tail_start=tail_start)[3]) # clean-tail 2x2\n",
838+
" rej_tail.append(fit_2x2(p, rs, tail_start=ts)[3]) # clean-tail 2x2\n",
839839
" rej_cs.append(fit_cs(p)[3])\n",
840840
" return np.mean(rej_tail), np.mean(rej_cs)\n",
841841
"\n",

0 commit comments

Comments
 (0)