Skip to content

Commit d045987

Browse files
igerberclaude
andcommitted
Update bundled LLM guides for dCDH survey + SDID jackknife
- diff_diff/guides/llms-practitioner.txt: add reversible-treatment branch to the Step 4 decision tree pointing at ChaisemartinDHaultfoeuille (alias DCDH), and a short Step 5 example showing the survey_design + L_max + TSL fallback for dCDH. The practitioner guide previously had zero dCDH coverage despite the full API being live. - diff_diff/guides/llms-full.txt: fix stale SyntheticDiDResults table (line 1024) — variance_method now accepts "bootstrap", "jackknife", or "placebo" (jackknife was added for synthdid::vcov parity but the table only listed bootstrap/placebo). Bundled-guide paths only. The old docs/llms-*.txt were moved to diff_diff/guides/ in main (PR #310); these edits target the new canonical location consumed by get_llm_guide(). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b376043 commit d045987

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

diff_diff/guides/llms-full.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ Returned by `SyntheticDiD.fit()`.
10211021
| `time_weights` | `dict` | Pre-treatment time weights |
10221022
| `pre_periods` | `list` | Pre-treatment periods |
10231023
| `post_periods` | `list` | Post-treatment periods |
1024-
| `variance_method` | `str` | "bootstrap" or "placebo" |
1024+
| `variance_method` | `str` | "bootstrap", "jackknife", or "placebo" |
10251025
| `noise_level` | `float` | Estimated noise level |
10261026
| `zeta_omega` | `float` | Unit weight regularization |
10271027
| `zeta_lambda` | `float` | Time weight regularization |

diff_diff/guides/llms-practitioner.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ Is treatment adoption staggered (multiple cohorts, different timing)?
173173
|-- NO, simple 2x2 design:
174174
| \-- DifferenceInDifferences (DiD)
175175
|
176+
|-- Treatment switches ON and OFF (reversible / non-absorbing)?
177+
| \-- ChaisemartinDHaultfoeuille (dCDH / alias `DCDH`)
178+
| -- Only library estimator for non-absorbing treatments; supports
179+
| L_max multi-horizon, dynamic placebos, cost-benefit delta,
180+
| HonestDiD, and `survey_design=` (pweight + strata/PSU/FPC via TSL)
181+
|
176182
|-- Few treated units (< 20)?
177183
| \-- SyntheticDiD (SDiD) -- synthetic control + DiD hybrid
178184
|
@@ -260,6 +266,27 @@ results = es.fit(data, outcome='y', unit='unit_id', time='period',
260266
print(results.summary())
261267
```
262268

269+
### Reversible (non-absorbing) treatment with survey design
270+
Use `ChaisemartinDHaultfoeuille` (dCDH) when treatment switches ON and OFF.
271+
Pass `survey_design=SurveyDesign(...)` for design-based inference via Taylor
272+
Series Linearization. Only `weight_type='pweight'` is supported; replicate
273+
weights are deferred. When combined with `n_bootstrap > 0`, dCDH emits a
274+
`UserWarning` and falls back to group-level multiplier bootstrap — prefer
275+
the analytical TSL path for survey-aware inference.
276+
277+
```python
278+
from diff_diff import ChaisemartinDHaultfoeuille, SurveyDesign
279+
280+
sd = SurveyDesign(weights='pw', strata='stratum', psu='cluster', nest=True)
281+
results = ChaisemartinDHaultfoeuille().fit(
282+
data, outcome='y', group='unit_id', time='period',
283+
treatment='treated',
284+
L_max=3, # multi-horizon event study
285+
survey_design=sd, # survey-aware analytical SE (TSL)
286+
)
287+
print(results.summary())
288+
```
289+
263290
---
264291

265292
## Step 6: Sensitivity Analysis

0 commit comments

Comments
 (0)