Add chapters 19–23 (Part III) and standardize LaTeX macros across all chapters#69
Add chapters 19–23 (Part III) and standardize LaTeX macros across all chapters#69Copilot wants to merge 9 commits into
Conversation
…ents
Chapter 19: Time-varying treatments
- Treatment history notation, counterfactuals under strategies
- Static vs. dynamic treatment strategies
- Sequentially randomized experiments
- Sequential exchangeability and positivity
- Time-varying confounding and feedback
Chapter 20: Treatment-confounder feedback
- Elements of feedback: L_k affected by A_{k-1} and confounds A_k
- Why standard regression (stratification, multivariable) fails
- Structural nature of the bias — not fixable by model flexibility
- Adjusting for past treatment produces controlled direct effects
Chapter 21: G-methods for time-varying treatments
- G-formula for time-varying treatments (big g-formula)
- IP weighting with stabilized weights SW^A and SW^C
- Doubly robust AIPW estimator
- G-estimation of structural nested mean models (SNMMs)
- Censoring as a time-varying treatment
Chapter 22: Target trial emulation
- ITT vs. per-protocol effects
- Specifying the target trial components
- Immortal time bias and new user/active comparator design
- Sequential trials design for time zero alignment
- Unified framework for observational causal inference
Chapter 23: Causal mediation
- Limitations of classical Baron-Kenny mediation analysis
- Natural direct and indirect effects (NDE, NIE)
- Controlled direct effect (CDE)
- Interventionist/stochastic mediation approach
- Time-varying mediators as a special case of g-methods
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ucdavis/win/sessions/a538ac1b-2966-4beb-8ded-682aaf0e2482 Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ucdavis/win/sessions/a538ac1b-2966-4beb-8ded-682aaf0e2482 Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
|
@copilot fix spellcheck |
Agent-Logs-Url: https://github.com/ucdavis/win/sessions/649063ba-d668-42f8-8808-dc446b1d6867 Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds Part III content (Chapters 19–23) to the Quarto lecture notes and standardizes common LaTeX operator notation across the existing chapters using the shared latex-macros submodule.
Changes:
- Added new Quarto chapters 19–23 (time-varying treatments through mediation), each rendering to HTML/RevealJS/PDF (and DOCX, consistent with existing chapters).
- Standardized expectation and independence notation across chapters (e.g.,
E[...]→\E{...},\perp\!\!\!\perp→\ind). - Updated
_quarto-website.ymlnavigation and expandedinst/WORDLISTfor new technical terms.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| inst/WORDLIST | Added causal-inference terms for spellcheck; removed duplicate entry. |
| _quarto-website.yml | Added sidebar navigation entries for new Chapters 19–23. |
| chapters/01-introduction.qmd | Macro standardization updates in math notation. |
| chapters/02-randomized-experiments.qmd | Macro standardization updates in math notation. |
| chapters/03-observational-studies.qmd | Macro standardization updates in math notation. |
| chapters/04-effect-modification.qmd | Macro standardization updates in math notation. |
| chapters/05-interaction.qmd | Macro standardization updates in math notation. |
| chapters/06-graphical-representation.qmd | Macro standardization updates in math notation. |
| chapters/07-confounding.qmd | Macro standardization updates in math notation. |
| chapters/09-measurement-bias.qmd | Macro standardization updates in math notation. |
| chapters/10-random-variability.qmd | Macro standardization updates in math notation. |
| chapters/11-why-model.qmd | Macro standardization updates in math notation. |
| chapters/12-ip-weighting-marginal-structural-models.qmd | Macro standardization updates in math notation. |
| chapters/13-standardization-parametric-g-formula.qmd | Macro standardization updates in math notation. |
| chapters/14-g-estimation-structural-nested-models.qmd | Macro standardization updates in math notation. |
| chapters/15-outcome-regression-propensity-scores.qmd | Macro standardization updates in math notation. |
| chapters/16-instrumental-variable-estimation.qmd | Macro standardization updates in math notation. |
| chapters/18-variable-selection-causal-inference.qmd | Macro standardization updates in math notation. |
| chapters/19-time-varying-treatments.qmd | New Chapter 19 content (Part III). |
| chapters/20-treatment-confounder-feedback.qmd | New Chapter 20 content (Part III). |
| chapters/21-g-methods-time-varying.qmd | New Chapter 21 content (Part III). |
| chapters/22-target-trial-emulation.qmd | New Chapter 22 content (Part III). |
| chapters/23-causal-mediation.qmd | New Chapter 23 content (Part III). |
|
@copilot apply changes based on the comments in this thread |
…ize nested E[] macros in ch02 and ch11 Agent-Logs-Url: https://github.com/ucdavis/win/sessions/29247ca6-572c-4454-bb3b-38fc70b077c5 Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Applied all three reviewer changes in 42c47e0:
|
| RStudio | ||
| RevealJS |
|
|
@claude review |
|
Claude finished @d-morrison's task in 4m 0s —— View job PR Review
SummaryThis PR adds Part III chapters (19–23) covering time-varying treatments through causal mediation, and standardizes LaTeX macro notation across all chapters. The content is substantively strong and the previously-flagged reviewer issues have been addressed. One outstanding issue remains. Outstanding Issue:
|
| Issue | Status |
|---|---|
immunosuppression removed from WORDLIST (ch08 still uses it) |
Fixed in 42c47e0 — word is present at line 48 |
Raw E[\hat{\theta}] inside \E{...} in chapters/11-why-model.qmd:215 |
Fixed — now reads \E{(\hat{\theta} - \E{\hat{\theta}})^2} |
Nested raw E[Y^a|L] / E[Y|A=a,L] in chapters/02-randomized-experiments.qmd |
Fixed — all four lines now use \E{\E{... \mid ...}} |
New Chapters 19–23 — General Assessment
All five chapters follow the established patterns correctly:
- Format headers match existing chapters exactly (html + revealjs + pdf + docx with correct output-file names)
- Macro include
{{< include ../latex-macros/macros.qmd >}}is present in every chapter - No raw
E[...]or\perp\!\!\!\perpfound — all expectations use\E{...}and all independence statements use\ind - Textbook citations follow the
@hernan2020causal [Chapter N, pp. X–Y]convention
One minor inconsistency: the new chapters use \Pr[...] (the LaTeX operator command, which renders Pr in roman) while most existing chapters use plain Pr[...] (renders italic in math mode). The new approach is technically more correct, but it creates a cross-chapter inconsistency. This is a low-priority cosmetic issue.
Navigation (_quarto-website.yml)
Clean addition — chapters 19–23 are appended in correct numeric order after chapter 18, with filenames and display text consistent with the established Chapter N: Title pattern.
WORDLIST New Terms
The 16 new terms (adherence, blip, blipped, CDE, collider, emulation, estimand, estimands, immortal, ITT, NDE, NIE, PP, pseudo-population, qmd, semiparametric, SNMM) are all legitimate technical terms or acronyms used in the new chapters. The removal of the duplicate ggdag entry is correct.
Bottom line: The PR is ready to merge once the WORDLIST alphabetical order is corrected. All substantive reviewer comments have been addressed.
|
chapters/19-time-varying-treatments.qmd(pp. 255-265)chapters/20-treatment-confounder-feedback.qmd(pp. 267-275)chapters/21-g-methods-time-varying.qmd(pp. 277-302)chapters/22-target-trial-emulation.qmd(pp. 305-320)chapters/23-causal-mediation.qmd(pp. 323-330)_quarto-website.ymlnavigation to include chapters 19-23\indmacro (replaces\perp\!\!\!\perp) across all chapters\E{...}macro (replacesE[...]) across all chaptersinst/WORDLIST; remove duplicateggdagentryqmdtoinst/WORDLISTto fix spell check CI failureimmunosuppressiontoinst/WORDLIST(was accidentally removed)E[\hat{\theta}]→\E{\hat{\theta}}inchapters/11-why-model.qmdE[Y^a|L]/E[Y|A=a,L]→\E{\E{...}}with\midinchapters/02-randomized-experiments.qmdspelling::spell_check_package()locally — no errors