Skip to content

Fill in proofs of Cox PH partial likelihood and Breslow baseline cumulative hazard#772

Open
d-morrison wants to merge 27 commits into
mainfrom
feat/coxph-partial-likelihood-proofs
Open

Fill in proofs of Cox PH partial likelihood and Breslow baseline cumulative hazard#772
d-morrison wants to merge 27 commits into
mainfrom
feat/coxph-partial-likelihood-proofs

Conversation

@d-morrison

Copy link
Copy Markdown
Owner

Summary

Adds proofs for the two estimators already stated (without justification) in _subfiles/proportional-hazards-models/_sec_fit-coxph.qmd, following Klein & Moeschberger (2003), §8.3, pp. 257–258 (theoretical notes 1 and 2):

  • Partial likelihood for the Cox PH coefficients $\beta$ — derived via the conditional-probability argument. Conditional on exactly one failure at $t_i$ among the risk set $R(t_i)$, the probability that subject $(i)$ is the one who fails is $\theta(x_{(i)}) / \sum_{k \in R(t_i)} \theta(x_k)$ after $\haz_0(t_i)$ cancels in the numerator and denominator. Multiplied across event times this is $\Lik^*(\beta)$, free of the baseline hazard.

  • Breslow estimator of the baseline cumulative hazard $\hat\cuhaz_0(t)$ — derived as a profile likelihood (Johansen 1983). Start from the full censored-data likelihood, restrict $\haz_0(\cdot)$ to point masses at observed event times, reindex the survival exponents by risk set, and maximize the separable log-likelihood over each $h_{0i}$. Plugging $\hat\cuhaz_0(t)$ back into the full likelihood recovers (up to constants) the partial likelihood, closing the loop.

What changed

  • New _subfiles/proportional-hazards-models/_proof-ph-partial-lik.qmd
  • New _subfiles/proportional-hazards-models/_proof-breslow-baseline-cuhaz-est.qmd
  • _sec_fit-coxph.qmd includes each proof immediately after the statement it justifies
  • Added Johansen (1983) to references.bib for the profile-likelihood attribution

Test plan

  • quarto render chapters/proportional-hazards-models.qmd --to html → clean
  • lintr::lint() on each touched/new file → No lints found
  • spelling::spell_check_package() → No spelling errors
  • Verified rendered HTML contains both proofs and resolves the @klein2003survival and @johansen1983extension citations

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 20, 2026 01:05
@github-actions github-actions Bot removed the request for review from Copilot May 20, 2026 01:06
@d-morrison

Copy link
Copy Markdown
Owner Author

@claude fix #772 (comment)

Copilot AI review requested due to automatic review settings May 20, 2026 02:22
@d-morrison d-morrison removed the request for review from Copilot May 20, 2026 02:22
@d-morrison

Copy link
Copy Markdown
Owner Author

@claude review

@d-morrison

Copy link
Copy Markdown
Owner Author

@claude fix

Copilot AI review requested due to automatic review settings May 20, 2026 04:26
@d-morrison d-morrison removed the request for review from Copilot May 20, 2026 04:26
@github-actions github-actions Bot deleted a comment from claude Bot May 21, 2026
@github-actions github-actions Bot deleted a comment from claude Bot May 21, 2026
@github-actions github-actions Bot deleted a comment from claude Bot May 21, 2026
@github-actions github-actions Bot deleted a comment from claude Bot May 21, 2026
@github-actions github-actions Bot deleted a comment from claude Bot May 21, 2026
Comment thread _subfiles/proportional-hazards-models/_proof-ph-partial-lik.qmd Outdated
@d-morrison

Copy link
Copy Markdown
Owner Author

@claude address #772 (review) and check all the math; fill in skipped steps

@github-actions github-actions Bot deleted a comment from claude Bot May 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👀 Picked up by workflow run #26202718534. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that.

@d-morrison

Copy link
Copy Markdown
Owner Author

@claude review

@github-actions

Copy link
Copy Markdown
Contributor

👀 Picked up by workflow run #26206186188. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that.

@d-morrison

Copy link
Copy Markdown
Owner Author

@claude review

@github-actions

Copy link
Copy Markdown
Contributor

👀 Picked up by workflow run #26207215963. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that.

@github-actions github-actions Bot deleted a comment from claude Bot May 21, 2026
@github-actions github-actions Bot deleted a comment from claude Bot May 21, 2026
@github-actions github-actions Bot deleted a comment from claude Bot May 21, 2026
@d-morrison

Copy link
Copy Markdown
Owner Author

@claude review

@github-actions

Copy link
Copy Markdown
Contributor

👀 Picked up by workflow run #26208226724. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that.

@github-actions github-actions Bot deleted a comment from claude Bot May 21, 2026
@claude

claude Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 3m 4s —— View job


Code Review — PR #772

  • Post initial comment
  • Read all changed files
  • Verify three previously-flagged fixes (forward ref, \eqdef in proof div, θ vs \hazfactor)
  • Check math correctness end-to-end
  • Check policy compliance (eqdef, no above/below, noun after This/That/Those, citations, macros)
  • Check cross-references and Quarto formatting

Three previously-flagged issues — all confirmed resolved ✅

# Issue Status
1 Forward reference to @def-breslow-baseline-cuhaz-est (lines 206–212) ✅ Removed; replaced with a discussion of Cox's justification for treating $\Lik^*(\b)$ as a likelihood — no Breslow reference remains before the definition's include at _sec_fit-coxph.qmd:82
2 \eqdef inside a proof div (line 148) ✅ Changed to =; \eqdef now appears only in {#def-...} divs
3 \theta vs \hazfactor notation mismatch ✅ No \theta(\vx) occurrences in either proof file; both proofs now use \hazfactor throughout, matching @thm-ph-haz-decomp and @def-ph-partial-lik notation exactly

All other checks — clean

Check Status
Math correctness (both proofs, end-to-end)
No \theta(\vx) (use \hazfactor) ✅ — grep confirms zero occurrences in both proof files
\eqdef only in {#def-...} divs ✅ — _def-ph-partial-lik.qmd lines 6, 8; _def-breslow-baseline-cuhaz-est.qmd line 4
No positional "above"/"below" ✅ — only lowering … below $h_{0i}$ (Breslow proof l.50) is a mathematical comparison
Noun phrase after This/That/Those ✅ — "This partial likelihood product" (partial lik. proof l.206), "This proportionality justifies" (Breslow proof l.180)
Citation locators inside brackets ✅ — [@klein2003survival, §8.3, Theoretical Note 1, p. 257], [@klein2003survival, §8.3], [@klein2003survival, §8.8], [@klein2003survival, §8.3, Theoretical Note 2, p. 258]
No bare \exp (use \expf{})
Cross-page refs as markdown links ✅ — #def-risk-set (_def-risk-set.qmd:2), #def-hazard (_def-hazard.qmd:2), #cor-surv-int-haz (_sec-cuhaz.qmd:4)
Same-page @label refs ✅ — @thm-ph-haz-decomp (_sec-understand-coxph.qmd:133), @thm-ph-cuhaz (l.319), @def-ph-partial-lik, @def-breslow-baseline-cuhaz-est, @johansen1983extension
Trailing newlines (both proof files, CLAUDE.md)
johansen1983extension bib entry ✅ — well-formed BibTeX (volume 51, number 2, pp. 165–174, DOI 10.2307/1402746)
CLAUDE.md new policies (3 lines) ✅ — \eqdef, no above/below, cross-page links, noun after This/That/Those

Verdict

No issues found. Ready to merge.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

👀 Picked up by workflow run #26918260960. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that.

@claude

claude Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 3m 16s —— View job


Code Review — PR #772

  • Post initial comment
  • Read all changed files
  • Check math correctness and derivation steps
  • Check policy compliance (eqdef, no above/below, noun after This/That/Those, citations, macros)
  • Check for forward references and notation consistency
  • Check Quarto/formatting conventions and cross-references
  • Post findings

Fresh review of current HEAD (merged with main). Three issues flagged in the previous automated review round are all confirmed resolved. Full scan below.

Three previously-flagged issues — all confirmed resolved ✅

# Issue Status
1 Forward reference to @def-breslow-baseline-cuhaz-est in partial likelihood proof ✅ Informational paragraph removed; no remaining reference to @def-breslow-baseline-cuhaz-est in _proof-ph-partial-lik.qmd
2 \eqdef inside a proof div (line 148) ✅ Changed to =; \eqdef now appears only in {#def-...} divs
3 \theta(\vx) vs \hazfactor(\vx) notation mismatch ✅ Zero \theta( occurrences in either proof file; both proofs use \hazfactor throughout, matching @thm-ph-haz-decomp and @def-ph-partial-lik notation exactly

Math correctness

_proof-ph-partial-lik.qmd — all steps correct:

  • Conditional probability identity under $A \subset B$: $\Pr(A \mid C) = \Pr(A \mid B \cap C),\Pr(B \mid C)$ with $A \cap B = A$
  • Noninformative censoring collapse: $j \in R(t_i) \Rightarrow C_j \ge t_i$; conditional independence makes $C_j \ge t_i$ uninformative ✅
  • Hazard approximation $\Pr{T_j \in [t_i, t_i+\Delta t) \mid T_j \ge t_i} \approx \haz(t_i \mid \vx_j),\Delta t$
  • Inclusion-exclusion denominator: $\sum_k \haz_0(t_i)\hazfactor(\vx_k)\Delta t$, dropping $O(\Delta t^2)$ co-failure terms ✅
  • Exact cancellation of $\haz_0(t_i),\Delta t$ (≈ vs = distinction maintained); ratio already $\Delta t$-free so limit is exact ✅
  • Factorization cross-check: $[\hazfactor(\vx_{(i)})/\sum_k\hazfactor(\vx_k)] \times [\haz_0(t_i)\sum_k\hazfactor(\vx_k)\Delta t] = \haz_0(t_i)\hazfactor(\vx_{(i)})\Delta t$ matches LHS underbrace ✅
  • Discarded factor depends on $\b$ through $\sum_k\hazfactor(\vx_k) = \sum_k\expf{\b'\vx_k}$

_proof-breslow-baseline-cuhaz-est.qmd — all steps correct:

  • Full likelihood substitution via @thm-ph-haz-decomp and @thm-ph-cuhaz
  • Point-mass argument: no gain from mass at non-event times; concentration at $t_i$ maximizes hazard-density factor ✅
  • Summation swap by Fubini: $\sum_j\hazfactor(\vx_j)\sum_{i:,t_i\le\tilde T_j}h_{0i} = \sum_i h_{0i}\sum_{j:,\tilde T_j\ge t_i}\hazfactor(\vx_j)$
  • Log-likelihood separability: each $\log h_{0i} - h_{0i}S_i$ involves only $h_{0i}$
  • FOC: $1/h_{0i} - S_i = 0 \Rightarrow \hat h_{0i} = 1/S_i$; SOC: $-1/h_{0i}^2 < 0$
  • Profile likelihood closure: $e^{-D}\cdot\Lik^*(\b)$; $e^{-D}$ free of $\b$

Policy compliance

Policy _proof-ph-partial-lik.qmd _proof-breslow-baseline-cuhaz-est.qmd
\eqdef only in {#def-...} divs ✅ no \eqdef in proof ✅ no \eqdef in proof
No positional "above"/"below" ✅ ("lowering … below $h_{0i}$" is mathematical comparison, not positional)
Noun phrase after This/That/Those ✅ "This partial likelihood product" (l.206), "this approximation" (l.55), "this equality" (l.153) ✅ "this definition" (l.78), "this critical point" (l.131), "This proportionality" (l.180)
Citation locators inside brackets [@klein2003survival, §8.3, Theoretical Note 1, p. 257], [@klein2003survival, §8.3], [@klein2003survival, §8.3, Theoretical Note 1] [@klein2003survival, §8.3, Theoretical Note 2, p. 258], [@klein2003survival, §8.8]
No bare \exp (use \expf{})
\hazfactor throughout (no \theta() ✅ — confirmed 0 occurrences ✅ — confirmed 0 occurrences

Cross-references

All markdown links verified:

  • intro-to-survival-analysis.qmd#def-risk-set_def-risk-set.qmd:2
  • intro-to-survival-analysis.qmd#def-hazard_def-hazard.qmd:2
  • intro-to-survival-analysis.qmd#cor-surv-int-haz_sec-cuhaz.qmd:4

Same-page @label refs verified:

  • @thm-ph-haz-decomp_sec-understand-coxph.qmd:133, same parent chapter ✅
  • @thm-ph-cuhaz_sec-understand-coxph.qmd:319, same parent chapter ✅
  • @def-ph-partial-lik — included at _sec_fit-coxph.qmd:62 before the proof at line 64 ✅
  • @def-breslow-baseline-cuhaz-est — referenced in Breslow proof (included at line 89), defined at line 82 ✅
  • @johansen1983extensionreferences.bib:134

Formatting

  • Both proof files end with :::\n (trailing newline confirmed) ✅
  • CLAUDE.md ends with trailing newline ✅
  • All three new CLAUDE.md policy lines present: \eqdef, no above/below, cross-page links, noun after This/That/Those ✅
  • johansen1983extension bib entry well-formed ✅
  • _sec_fit-coxph.qmd:85: "This estimator reduces to the Nelson-Aalen estimate…" ✅
  • _def-ph-partial-lik.qmd: \eqdef for both \Lik^*_i(\b) and \Lik^*(\b)
  • _def-breslow-baseline-cuhaz-est.qmd: \eqdef for \hat\cuhaz_0(t)

Verdict

No issues found. Ready to merge.

@d-morrison

Copy link
Copy Markdown
Owner Author

Claude Code CLI (local session) is working on this — syncing with main first. Paws off until I'm done.

…kelihood-proofs

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
@claude

claude Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 6m 19s —— View job


Code Review — PR #772

  • Post initial comment
  • Read all changed files
  • Check math correctness and derivation steps
  • Check policy compliance (eqdef, no above/below, noun after This/That/Those, citations, macros)
  • Check for forward references and notation consistency
  • Check Quarto/formatting conventions and cross-references

Fresh review of current HEAD (merge sync with main). This is a full re-verification of the branch state.

Three previously-flagged issues — all confirmed resolved ✅

# Issue Status
1 Forward reference to @def-breslow-baseline-cuhaz-est in _proof-ph-partial-lik.qmd ✅ Removed; no @def-breslow-baseline-cuhaz-est anywhere in _proof-ph-partial-lik.qmd
2 \eqdef inside proof div (_proof-ph-partial-lik.qmd:147) ✅ Changed to =; \eqdef now appears only in the two {#def-...} divs
3 \theta(\vx) vs \hazfactor(\vx) notation mismatch ✅ Zero \theta( occurrences in both proof files; proofs match @thm-ph-haz-decomp and @def-ph-partial-lik notation exactly

Math correctness

_proof-ph-partial-lik.qmd — all steps correct:

  • Conditional probability identity under $A \subset B$: $\Pr(A \mid C) = \Pr(A \mid B \cap C),\Pr(B \mid C)$ with $A \cap B = A$
  • Noninformative-censoring collapse: $j \in R(t_i) \Rightarrow C_j \ge t_i$; conditional independence makes $C_j \ge t_i$ uninformative about $T_j$
  • Hazard approximation: $\Pr{T_j \in [t_i, t_i+\Delta t) \mid T_j \ge t_i} \approx \haz(t_i \mid \vx_j),\Delta t$
  • Inclusion-exclusion denominator: $\sum_k \haz_0(t_i)\hazfactor(\vx_k)\Delta t$, dropping $O(\Delta t^2)$ co-failure terms ✅
  • Exact cancellation of $\haz_0(t_i),\Delta t$ (≈ vs = distinction maintained) ✅
  • Factorization cross-check: $[\hazfactor(\vx_{(i)})/\sum_k\hazfactor(\vx_k)] \times [\haz_0(t_i)\sum_k\hazfactor(\vx_k)\Delta t] = \haz_0(t_i)\hazfactor(\vx_{(i)})\Delta t$ matches the LHS underbrace ✅
  • Discarded factor depends on $\b$ through $\sum_k\hazfactor(\vx_k) = \sum_k\expf{\b'\vx_k}$

_proof-breslow-baseline-cuhaz-est.qmd — all steps correct:

  • Full likelihood substitution via @thm-ph-haz-decomp and @thm-ph-cuhaz
  • Point-mass argument: no gain from mass at non-event times; concentration at $t_i$ maximizes hazard-density factor ✅
  • Summation swap by Fubini: $\sum_j\hazfactor(\vx_j)\sum_{i:,t_i\le\tilde T_j}h_{0i} = \sum_i h_{0i}\sum_{j:,\tilde T_j\ge t_i}\hazfactor(\vx_j)$
  • Log-likelihood separability: each $\log h_{0i} - h_{0i}S_i$ involves only $h_{0i}$
  • FOC: $1/h_{0i} - S_i = 0 \Rightarrow \hat h_{0i} = 1/S_i$; SOC: $-1/h_{0i}^2 &lt; 0$
  • Profile likelihood closure: $e^{-D}\cdot\Lik^*(\b)$; $e^{-D}$ free of $\b$

Policy compliance

Policy _proof-ph-partial-lik.qmd _proof-breslow-baseline-cuhaz-est.qmd
\eqdef only in {#def-...} divs ✅ no \eqdef in proof ✅ no \eqdef in proof
No positional "above"/"below" ✅ ("lowering … below $h_{0i}$" is a mathematical comparison, not positional)
Noun phrase after This/That/Those ✅ "this approximation" (l.55), "this equality" (l.153), "This partial likelihood product" (l.206) ✅ "this definition" (l.78), "this critical point" (l.131), "This proportionality" (l.180)
Citation locators inside brackets [@klein2003survival, §8.3, Theoretical Note 1, p. 257], [@klein2003survival, §8.3] [@klein2003survival, §8.3, Theoretical Note 2, p. 258], [@klein2003survival, §8.8]
No bare \theta(\vx) (use \hazfactor) ✅ — confirmed 0 occurrences ✅ — confirmed 0 occurrences
No bare \exp (use \expf{}) ✅ — confirmed 0 occurrences ✅ — confirmed 0 occurrences

Cross-references

All cross-page markdown links verified:

  • intro-to-survival-analysis.qmd#def-risk-set_def-risk-set.qmd:2
  • intro-to-survival-analysis.qmd#def-hazard_def-hazard.qmd:2
  • intro-to-survival-analysis.qmd#cor-surv-int-haz_sec-cuhaz.qmd:4

Same-page @label refs verified (all in chapters/proportional-hazards-models.qmd):

  • @thm-ph-haz-decomp_sec-understand-coxph.qmd:133, included at chapter line 23, before _sec_fit-coxph.qmd at chapter line 31 ✅
  • @thm-ph-cuhaz_sec-understand-coxph.qmd:319, same ✅
  • @def-ph-partial-lik — included at _sec_fit-coxph.qmd:62, before the proof at line 64 ✅
  • @def-breslow-baseline-cuhaz-est — included at _sec_fit-coxph.qmd:82, before the Breslow proof at line 89 ✅
  • @johansen1983extensionreferences.bib:134 (newly added by this PR) ✅
  • @cox1972regressionreferences.bib (pre-existing) ✅

Macros

All custom macros in both proof files verified in latex-macros/macros.qmd:

  • \hazfactor (l.467), \haz (l.427), \cuhaz (l.453), \surv (l.27) ✅
  • \expf{} (l.293), \eqdef (l.96), \Lik (l.142), \loglik (l.144) ✅
  • \vx (l.343), \b (l.50), \ba/\ea (l.128/129), \set{} (l.320), \sb{} (l.7), \cb{} (l.2), \paren{} (l.4) ✅

Formatting

  • Both proof files end with a trailing newline ✅
  • CLAUDE.md ends with trailing newline ✅
  • All four new CLAUDE.md policy lines present: \eqdef in defs, no above/below, cross-page links, noun after This/That/Those ✅
  • johansen1983extension bib entry well-formed (volume 51, number 2, pp. 165–174, DOI 10.2307/1402746) ✅
  • _def-ph-partial-lik.qmd: \eqdef for both \Lik^*_i(\b) and \Lik^*(\b)
  • _def-breslow-baseline-cuhaz-est.qmd: \eqdef for \hat\cuhaz_0(t)
  • _sec_fit-coxph.qmd:85: "This estimator reduces to the Nelson-Aalen estimate…" ✅

Pre-existing issue (not this PR's responsibility)

_sec_fit-coxph.qmd:77 (unchanged text): "this also defines $\hat\eta(x)$ and $\hat\hazfactor(x)$" — bare "this" without noun phrase. Not introduced by this PR; out of scope.

Verdict

No issues found. Ready to merge.

…ompose

Reorder the proof of the Cox PH partial likelihood so it starts from the
full likelihood of the realized failure sequence and decomposes each
factor into a which-subject-fails part (kept) and a whether-a-failure
part (discarded), rather than building the conditional probability first
and appending the decomposition. Add labeled intermediate equations and
remove the prior redundant double derivation of the ratio.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
@claude

claude Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 4m 30s —— View job


Code Review — PR #772

  • Post initial comment
  • Read all changed files
  • Check math correctness and derivation steps
  • Check policy compliance (eqdef, no above/below, noun after This/That/Those, citations, macros)
  • Check for forward references and notation consistency
  • Check Quarto/formatting conventions and cross-references

Fresh review of current HEAD (merged with main). All issues flagged in previous automated review rounds are confirmed resolved.

Three previously-open issues — all confirmed resolved ✅

# Issue Status
1 Forward reference to @def-breslow-baseline-cuhaz-est in partial-likelihood proof ✅ Removed; grep confirms zero occurrences of def-breslow-baseline-cuhaz-est in _proof-ph-partial-lik.qmd
2 \eqdef inside proof div (_proof-ph-partial-lik.qmd) ✅ Changed to =; grep confirms zero \eqdef in both proof files
3 \theta(\vx) vs \hazfactor(\vx) notation mismatch ✅ Zero \theta( in both proof files; \hazfactor used throughout, matching @thm-ph-haz-decomp and @def-ph-partial-lik exactly

Math correctness

_proof-ph-partial-lik.qmd — all steps correct:

  • Chain rule $\Pr(A \mid C) = \Pr(A \mid B \cap C),\Pr(B \mid C)$ with $A \subset B$ (so $A \cap B = A$) ✅
  • Noninformative-censoring collapse: $j \in R(t_i) \Rightarrow C_j \ge t_i$; conditional independence makes $C_j \ge t_i$ uninformative about $T_j$
  • Hazard approximation $\Pr{T_j \in [t_i, t_i+\Delta t) \mid T_j \ge t_i} \approx \haz(t_i \mid \vx_j),\Delta t$
  • Inclusion-exclusion denominator: $\sum_k \haz_0(t_i)\hazfactor(\vx_k)\Delta t$, dropping $O(\Delta t^2)$ co-failure terms ✅
  • Exact cancellation of $\haz_0(t_i),\Delta t$ (≈ vs = distinction correctly maintained) ✅
  • Factorization: "which-subject-fails" × "whether-a-failure-occurs" = $\frac{\hazfactor(\vx_{(i)})}{\sum_k\hazfactor(\vx_k)} \times \haz_0(t_i)\sum_k\hazfactor(\vx_k)\Delta t = \haz_0(t_i)\hazfactor(\vx_{(i)})\Delta t$ (matches LHS underbrace) ✅
  • Discarded factor depends on $\b$ through $\sum_k\hazfactor(\vx_k) = \sum_k\expf{\b'\vx_k}$

_proof-breslow-baseline-cuhaz-est.qmd — all steps correct:

  • Full likelihood substitution via @thm-ph-haz-decomp and @thm-ph-cuhaz
  • Point-mass argument: no gain from mass at non-event times; concentration at $t_i$ maximizes hazard-density factor ✅
  • Summation swap (Fubini): $\sum_j\hazfactor(\vx_j)\sum_{i:,t_i\le\tilde T_j}h_{0i} = \sum_i h_{0i}\sum_{j:,\tilde T_j\ge t_i}\hazfactor(\vx_j)$
  • Log-likelihood separability: each $\log h_{0i} - h_{0i}S_i$ involves only $h_{0i}$
  • FOC: $1/h_{0i} - S_i = 0 \Rightarrow \hat h_{0i} = 1/S_i$; SOC: $-1/h_{0i}^2 &lt; 0$ confirms maximum ✅
  • Profile likelihood closure: $e^{-D}\cdot\Lik^*(\b)$; $e^{-D}$ is free of $\b$

Policy compliance

Policy _proof-ph-partial-lik.qmd _proof-breslow-baseline-cuhaz-est.qmd
\eqdef only in {#def-...} divs ✅ no \eqdef in proof ✅ no \eqdef in proof
No positional "above"/"below" ✅ — "lowering … below $h_{0i}$" (line 50) is a mathematical comparison, not positional
Noun phrase after This/That/Those ✅ "this approximation" (l.55), "this equality" (l.153), "This partial likelihood product" (l.198) ✅ "this definition" (l.78), "this critical point" (l.131), "This proportionality" (l.180)
Citation locators inside brackets [@klein2003survival, §8.3, Theoretical Note 1, p. 257], [@klein2003survival, §8.3] [@klein2003survival, §8.3, Theoretical Note 2, p. 258], [@klein2003survival, §8.8]
\hazfactor throughout (no \theta() ✅ — confirmed 0 occurrences ✅ — confirmed 0 occurrences
No bare \exp (use \expf{})

Cross-references

All cross-page markdown links verified:

  • intro-to-survival-analysis.qmd#def-risk-set_def-risk-set.qmd:2
  • intro-to-survival-analysis.qmd#def-hazard_def-hazard.qmd:2
  • intro-to-survival-analysis.qmd#cor-surv-int-haz_sec-cuhaz.qmd:4

Same-page @label refs verified (both proofs included inside chapters/proportional-hazards-models.qmd):

  • @thm-ph-haz-decomp_sec-understand-coxph.qmd:133, included before _sec_fit-coxph.qmd
  • @thm-ph-cuhaz_sec-understand-coxph.qmd:319, same ✅
  • @def-ph-partial-lik — included at _sec_fit-coxph.qmd:62, before the proof at line 64 ✅
  • @def-breslow-baseline-cuhaz-est — included at _sec_fit-coxph.qmd:82, before the Breslow proof at line 89 ✅
  • @johansen1983extension — newly added references.bib:134, well-formed BibTeX entry ✅
  • @cox1972regressionreferences.bib (pre-existing) ✅

Other checks

Check Status
Trailing newlines (both proofs, CLAUDE.md, both defs) ✅ — wc -l confirms all six changed files end with \n
\eqdef in both {#def-...} divs ✅ — _def-ph-partial-lik.qmd lines 6, 8; _def-breslow-baseline-cuhaz-est.qmd line 4
x_k\vx_k in _def-breslow-baseline-cuhaz-est.qmd ✅ — bug fix, correct macro now used
< t≤ t in Breslow estimator definition ✅ — right-continuous cumulative hazard convention, consistent with proof
CLAUDE.md 4 new policy lines ✅ — \eqdef, no above/below, cross-page links, noun-after-This/That/Those
johansen1983extension bib entry ✅ — well-formed (volume 51, number 2, pp. 165–174, DOI 10.2307/1402746)
Equation labels (@eq-ph-full-lik, etc.) used within same file

Pre-existing nit (out of scope)

_sec_fit-coxph.qmd:77 (unchanged text): "this also defines $\hat\eta(x)$ and $\hat\hazfactor(x)$" — bare "this" without noun phrase. Not introduced by this PR; out of scope per CLAUDE.md workflow responsibility.

Verdict

No issues found. Ready to merge.

Start the proof from the genuine joint likelihood of the observed data
set, prod_j S(T_j|x_j) h(T_j|x_j)^delta_j, with no risk-set conditioning,
citing the censored-data likelihood from the survival chapter. Discretize
the survival factors over a time grid, regroup the (subject, interval)
factors by interval so the risk sets emerge as conditioning sets, then
decompose each event interval via the chain rule into the kept partial
likelihood and a discarded remainder. The discarded factor now honestly
includes the between-event survival background, not just the
whether-a-failure terms, and is where all baseline-hazard dependence
lives. No steps skipped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
@claude

claude Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 7m 45s —— View job


Code Review — PR #772

  • Post initial comment
  • Read all changed files
  • Check math correctness and derivation steps
  • Check policy compliance (eqdef, no above/below, noun after This/That/Those, citations, macros)
  • Check for forward references and notation consistency
  • Check Quarto/formatting conventions and cross-references
  • Post findings

Fresh review of current HEAD — latest two commits (ec982c8, e9f6718) substantially rewrote _proof-ph-partial-lik.qmd to start from the full joint likelihood. Math is correct throughout. Two new cross-reference issues found in the rewritten content; everything else is clean.


Issue 1 — Cross-proof inconsistency: #the-cumulative-hazard-function vs #cor-surv-int-haz (nit)

_proof-ph-partial-lik.qmd:48:

(the [survival/cumulative-hazard relationship](intro-to-survival-analysis.qmd#the-cumulative-hazard-function))

_proof-breslow-baseline-cuhaz-est.qmd:24 (citing the same relationship $S(t) = \exp{-\cuhaz(t)}$):

from the [survival/cumulative hazard relationship](intro-to-survival-analysis.qmd#cor-surv-int-haz)

The Breslow proof correctly links to #cor-surv-int-haz, the specific corollary defined with an explicit {#cor-surv-int-haz} anchor in _subfiles/intro-to-survival-analysis/_sec-cuhaz.qmd:4. The partial-likelihood proof instead links to #the-cumulative-hazard-function, an auto-generated anchor derived from the section heading ## The Cumulative Hazard Function in _sec-surv-dists.qmd:54. Both links work in the current rendered HTML, but:

  1. The two proofs are inconsistent in how they cite the same relationship.
  2. The auto-generated anchor is fragile: if the section heading is renamed, the link silently breaks with no compile-time warning. The explicit {#cor-surv-int-haz} anchor won't have this problem.
  3. The section-heading anchor takes the reader to a broader section rather than the specific corollary — less helpful.

Fix: change intro-to-survival-analysis.qmd#the-cumulative-hazard-function to intro-to-survival-analysis.qmd#cor-surv-int-haz at line 48 of _proof-ph-partial-lik.qmd.

Fix this →


Issue 2 — Auto-generated anchor for likelihood-with-censoring (nit)

_proof-ph-partial-lik.qmd:20:

[censored-data likelihood](intro-to-survival-analysis.qmd#likelihood-with-censoring)

This links to #likelihood-with-censoring, which is an auto-generated anchor derived from the section heading ## Likelihood with censoring (_sec-surv-dists.qmd:66). There is no explicit {#likelihood-with-censoring} anchor defined anywhere.

All other cross-page links in the same file use explicitly-defined anchors: #def-risk-set, #def-hazard, #cor-surv-int-haz. The auto-generated anchor works currently but will silently break if the heading text is renamed.

There is no explicit anchor to add the reference to (unlike issue 1), so the cleanest fix is to either (a) add {#sec-likelihood-with-censoring} to the heading in _sec-surv-dists.qmd and update the reference, or (b) accept the current fragility. This is purely a robustness nit.


Math correctness — new proof structure ✅

The rewritten proof is mathematically sound end-to-end:

  • Full joint likelihood (eq-ph-obs-lik): Standard censored-data form $\prod_j S(\tilde T_j|x_j) h(\tilde T_j|x_j)^{\delta_j}$. ✅
  • Discretization (eq-ph-surv-discretized): Left Riemann sum → $e^{-x} \approx 1-x$ first-order approximation; $\Delta t^D$ factor absorbed as it is constant in $\b, h_0$. ✅
  • Regroup by interval (eq-ph-lik-by-interval): Valid index swap — each $(\text{subject},\text{interval})$ pair is counted once. ✅
  • Single-subject failure probability (eq-ph-single-subj): Noninformative censoring argument correct; hazard approximation cited. ✅
  • Which-subject-fails factor (eq-ph-which-subject): $h_0(t_i)\Delta t$ cancels exactly in numerator and denominator; $\approx$$=$ transition properly explained. ✅
  • Full factorization (eq-ph-factored-lik): Kept = $\Lik^*(\b)$; discarded contains between-event survival background + whether-failure factors. ✅
  • Discarded factor non-independence claim (lines 277–282): Correctly identifies $\sum_k \hazfactor(\vx_k)$ as $\b$-dependent even in the discarded factor. ✅

Policy compliance ✅

Policy Status
\eqdef only in {#def-...} divs ✅ — zero \eqdef in either proof file
\hazfactor throughout (no \theta() ✅ — confirmed 0 occurrences
No positional "above"/"below"
Noun phrase after This/That/Those ✅ — "This partial likelihood product" (l.284), "This proportionality justifies" (Breslow l.180)
Citation locators inside brackets ✅ — [@klein2003survival, §8.3, Theoretical Note 1, p. 257], [@klein2003survival, §8.3], [@klein2003survival, §8.8]
No bare \exp (use \expf{})
Trailing newlines

Cross-references ✅ (except as noted)

Reference Status
#def-risk-set (explicit anchor)
#def-hazard (explicit anchor)
#likelihood-with-censoring (auto-generated, issue 2) ⚠️ works but fragile
#the-cumulative-hazard-function (auto-generated, issue 1) ⚠️ inconsistent with Breslow proof; should be #cor-surv-int-haz
@thm-ph-haz-decomp, @thm-ph-cuhaz, @def-ph-partial-lik ✅ same-page
@johansen1983extension

Verdict

Two nits in the rewritten proof content (both cross-reference issues, neither blocking correctness). The math is correct, all previously-flagged items remain resolved, and policy compliance is clean. The rewrite successfully grounds the partial-likelihood proof in the full joint likelihood before extracting the partial likelihood.

d-morrison and others added 2 commits June 5, 2026 15:00
Switch the partial-likelihood proof to the univariate-survival chapter's
observed-time/event-indicator notation: Y_j = min(T_j, C_j) and
D_j = 1{T_j <= C_j} (was \tilde T_j, \delta_j). Rename the count of
distinct event times from D to K so it no longer collides with the
per-subject indicator D_j (the tie-multiplicity d_i is unchanged).
Remove the unnecessary \;=\; / \;\approx\; thick-space wrapping around
relational operators, relying on default math spacing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
…kelihood-proofs

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
@claude

claude Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 6m 21s —— View job


Code Review — PR #772

  • Read all changed files
  • Check math correctness and derivation steps
  • Check policy compliance (eqdef, no above/below, noun after This/That/Those, citations, macros)
  • Check for forward references and notation consistency
  • Check Quarto/formatting conventions and cross-references
  • Post findings

Fresh review of current HEAD (latest merge with main, commits ec982c8/e9f6718/7f953c2). The partial-likelihood proof has been substantially rewritten to derive the partial likelihood from the full joint censored-data likelihood. Math is correct throughout.

Three previously-open issues — all confirmed resolved ✅

# Issue Status
1 Forward reference to @def-breslow-baseline-cuhaz-est in partial-likelihood proof ✅ Removed entirely
2 \eqdef inside proof div ✅ Changed to =
3 \theta(\vx) vs \hazfactor(\vx) notation mismatch ✅ Zero \theta( in both proof files

Two issues from the previous review — still open

Issue A — Fragile auto-generated anchor (_proof-ph-partial-lik.qmd:49)

(the [survival/cumulative-hazard relationship](intro-to-survival-analysis.qmd#the-cumulative-hazard-function))

#the-cumulative-hazard-function is auto-generated from the section heading ## The Cumulative Hazard Function in _sec-surv-dists.qmd:54. The explicit stable anchor {#cor-surv-int-haz} exists in _sec-cuhaz.qmd:4 and is what the Breslow proof correctly uses (_proof-breslow-baseline-cuhaz-est.qmd:24). The two proofs are inconsistent, and the auto-generated anchor silently breaks if the heading is renamed.

Fix: change #the-cumulative-hazard-function#cor-surv-int-haz at line 49.

Fix this →

Issue B — Auto-generated anchor for censored-data likelihood (_proof-ph-partial-lik.qmd:12, 22)

[censored-data likelihood](intro-to-survival-analysis.qmd#likelihood-with-censoring)

#likelihood-with-censoring is auto-generated from the section heading ## Likelihood with censoring in _sec-surv-dists.qmd:66. Unlike Issue A, there is no explicit {#sec-likelihood-with-censoring} or {#likelihood-with-censoring} anchor to use instead. Options: (a) add an explicit anchor to the heading in _sec-surv-dists.qmd, or (b) accept the current fragility. Both references use the same auto-generated anchor so at least they are consistent with each other.

New findings

Issue C — d_i undefined in partial-likelihood proof (nit, _proof-ph-partial-lik.qmd:267–269)

Under the no-ties assumption each event time has $d_i = 1$, so the kept
product $\prod_{i=1}^{K}(\cdots) = \prod_{\{i:\,d_i=1\}}(\cdots)$ matches
the form of $\Lik^*(\b)$ in @def-ph-partial-lik.

d_i (number of events at $t_i$) is never defined in the partial-likelihood proof. The proof defines D_j (subject-level event indicator, line 10) but the per-event-time count d_i only appears here without introduction. By contrast, the Breslow proof (_proof-breslow-baseline-cuhaz-est.qmd:143) explicitly says "the numerator generalizes to $d_i$, the number of events at $t_i$". A brief parenthetical — "where $d_i = 1$ (one failure per event time, by no-ties)" — would close the gap.

Issue D — Cross-proof notation inconsistency (nit)

The two proofs use different symbols for the same quantities:

Quantity Partial-likelihood proof Breslow proof
Observed follow-up time Y_j (line 9) \tilde{T}_j (line 14)
Event indicator D_j (line 10) \delta_j (line 14)

Both are self-contained — each proof defines its own symbols. But a reader working through both proofs in sequence encounters two different notations for the same model. The partial-likelihood proof's choice of Y_j/D_j is deliberate (matching the cross-referenced censored-data likelihood section), while the Breslow proof follows Klein & Moeschberger convention. A one-sentence note in the Breslow proof ("(using $\tilde{T}_j = Y_j$, $\delta_j = D_j$ from the partial-likelihood proof)") would help the reader cross-identify, but this is a minor stylistic choice.

All other checks — clean

Check Status
Math correctness — both proofs end-to-end
\hazfactor throughout (zero \theta()
\eqdef only in {#def-...} divs
No positional "above"/"below" ✅ — "lowering … below $h_{0i}$" (Breslow l.50) is mathematical comparison
Noun phrase after This/That/Those ✅ — "This partial likelihood product" (l.285), "This proportionality" (Breslow l.180)
Citation locators inside brackets
No bare \exp
\1{...} indicator macro ✅ — defined in macros.qmd:315, used consistently across the book
Cross-page refs as markdown links ✅ (except Issues A/B above)
Same-page @label refs ✅ — @thm-ph-haz-decomp, @thm-ph-cuhaz, @def-ph-partial-lik, @def-breslow-baseline-cuhaz-est, @johansen1983extension
Trailing newlines
\eqdef in both {#def-...} divs
CLAUDE.md policies
johansen1983extension bib entry

Verdict

Two open nits from the previous review (Issues A and B, both anchor-robustness issues), plus two new nits (C and D). Issue A is the most actionable: swap #the-cumulative-hazard-function for #cor-surv-int-haz to match the Breslow proof and use a stable explicit anchor. Issues B, C, and D are lower priority. Math is correct, all previously-flagged items are resolved, policy compliance is clean.

@claude

claude Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 7m 28s —— View job


Code Review — PR #772

  • Read all changed files
  • Check math correctness and derivation steps
  • Check policy compliance (eqdef, no above/below, noun after This/That/Those, citations, macros)
  • Check for forward references and notation consistency
  • Check Quarto/formatting conventions and cross-references
  • Post findings

Fresh review of HEAD (current branch state). CI: ✅ Spellcheck, ✅ Lint; Quarto Preview in progress.

Previously-flagged issues — confirmed resolved ✅

# Issue Status
1 Forward reference to @def-breslow-baseline-cuhaz-est in partial-likelihood proof ✅ Removed entirely
2 \eqdef inside proof div ✅ Changed to =
3 \theta(\vx) vs \hazfactor(\vx) notation mismatch \hazfactor used throughout both proofs
4 No "above"/"below" positional references
5 Noun phrase after This/That/Those ✅ "this approximation" (l.55), "this equality" (l.153), "This partial likelihood product" (l.285), "this definition" (Breslow l.78), "This proportionality" (Breslow l.180)
6 Citation locators inside brackets [@klein2003survival, §8.3, Theoretical Note 1, p. 257] etc.
7 Trailing newlines ✅ both proof files

Math correctness ✅

_proof-ph-partial-lik.qmd — all steps correct:

  • Full joint likelihood form @eq-ph-obs-lik is standard censored-data form ✅
  • Discretization @eq-ph-surv-discretized: Riemann sum, then e^{-x} ≈ 1 − x first-order approximation ✅
  • Δt^{D_j} correctly absorbed as constant in β, h₀
  • Regrouping by interval @eq-ph-lik-by-interval: valid index swap (same (subject, interval) pairs, different grouping) ✅
  • Single-subject failure probability @eq-ph-single-subj: noninformative-censoring argument correct; hazard cited ✅
  • Chain-rule factorization @eq-ph-chain-rule: A ⊂ B so Pr(A|C) = Pr(A|B∩C) Pr(B|C)
  • Whether-failure factor @eq-ph-one-failure: inclusion-exclusion, O(Δt²) cross-terms dropped ✅
  • Which-subject factor @eq-ph-which-subject: h₀(tᵢ) Δt cancels exactly; vs = distinction maintained ✅
  • Factored likelihood @eq-ph-factored-lik: kept = Lik*(β), discarded = whether-failure factors + between-event survival ✅
  • Discarded factor's β-dependence through ∑ hazfactor(xₖ) correctly noted ✅

_proof-breslow-baseline-cuhaz-est.qmd — all steps correct:

  • Full likelihood substitution via @thm-ph-haz-decomp and @thm-ph-cuhaz
  • Point-mass argument: non-event-time mass only penalizes survival ✅
  • Summation swap (Fubini) ✅; Sᵢ definition ✅
  • Log-likelihood separability; FOC → ĥ₀ᵢ = 1/Sᵢ; SOC < 0 ✅
  • Profile likelihood closure: e^{−D} · Lik*(β); e^{−D} free of β

Open issues

Issue A — Fragile auto-generated anchor (nit, actionable)

_proof-ph-partial-lik.qmd:49:

(the [survival/cumulative-hazard relationship](intro-to-survival-analysis.qmd#the-cumulative-hazard-function))

#the-cumulative-hazard-function is auto-generated from the section heading ## The Cumulative Hazard Function in _sec-surv-dists.qmd:54. The explicit stable anchor {#cor-surv-int-haz} exists at _sec-cuhaz.qmd:4 and is what the Breslow proof correctly uses (_proof-breslow-baseline-cuhaz-est.qmd:24). The two proofs are inconsistent; the auto-generated anchor silently breaks if the heading is renamed.

Fix: change #the-cumulative-hazard-function#cor-surv-int-haz at line 49 only.

Fix this →


Issue C — d_i undefined in partial-likelihood proof (proof gap)

_proof-ph-partial-lik.qmd:267–269:

Under the no-ties assumption each event time has $d_i = 1$, so the kept
product $\prod_{i=1}^{K}(\cdots) = \prod_{\{i:\,d_i=1\}}(\cdots)$ matches
the form of $\Lik^*(\b)$ in @def-ph-partial-lik.

d_i (number of events at event time tᵢ) is never defined in this proof. The Breslow proof (_proof-breslow-baseline-cuhaz-est.qmd:143) defines it as "the number of events at tᵢ". Since @def-ph-partial-lik uses {i : dᵢ = 1} in its product, the connection requires defining dᵢ. Suggested fix: add a parenthetical definition, e.g.:

"Under the no-ties assumption each event time has $d_i = 1$ (where $d_i$ denotes the number of failures at $t_i$), so..."

Fix this →


Issue E — D undefined in Breslow proof; K/D inconsistency between proofs (nit)

The Breslow proof uses D throughout (i ∈ {1,…,D} at line 57; ∏_{i=1}^D, e^{−D}, ĥ_{0D}, etc.) without ever defining what D is. By contrast, the partial-likelihood proof explicitly defines K at line 15: "let t₁ < ⋯ < t_K be the K distinct observed failure times." Both letters refer to the same quantity (number of distinct event times under no-ties), but a reader working through both proofs encounters two different letters with no bridging statement.

Suggested fix: add a setup sentence to the Breslow proof preamble (after line 6) mirroring the partial-likelihood proof's notation introduction:

"Let $t_1 &lt; \dots &lt; t_D$ be the $D$ distinct observed event times and let $(i)$ denote the subject who fails at $t_i$."

Fix this →


Issue B — #likelihood-with-censoring auto-generated anchor (lower-priority nit)

_proof-ph-partial-lik.qmd:12,22 links to intro-to-survival-analysis.qmd#likelihood-with-censoring. This is auto-generated from the heading ## Likelihood with censoring in _sec-surv-dists.qmd:66; no explicit {#sec-...} anchor exists on that heading. Both lines use the same anchor (internally consistent), but it's fragile. Fix requires adding {#sec-likelihood-with-censoring} to the heading in _sec-surv-dists.qmd — a change outside this PR's files.


Issue D — cross-proof notation mismatch (lower-priority nit)

The two proofs use different symbols for the same model quantities:

Quantity _proof-ph-partial-lik.qmd _proof-breslow-baseline-cuhaz-est.qmd
Observed follow-up time Y_j \tilde{T}_j
Event indicator D_j \delta_j

Each proof is self-contained but a reader switching between them encounters two notation systems with no bridge. The partial-likelihood proof explicitly cites its notation as matching "the Y, D notation of the censored-data likelihood" (line 11–12), which partially justifies the choice; the Breslow proof follows Klein & Moeschberger convention. An optional bridging note in one proof would help — not blocking.


All other checks — clean

Check Status
\eqdef only in {#def-...} divs ✅ — _def-ph-partial-lik.qmd lines 6,8; _def-breslow-baseline-cuhaz-est.qmd line 4; zero \eqdef in either proof file
\hazfactor throughout (zero \theta()
No bare \exp (use \expf{})
\1{} indicator macro ✅ — defined at macros.qmd:315
Same-page @label refs ✅ — @thm-ph-haz-decomp, @thm-ph-cuhaz, @def-ph-partial-lik, @def-breslow-baseline-cuhaz-est, @johansen1983extension all resolve
Cross-page refs as markdown links (except Issue A)
CLAUDE.md new policies (4 lines) ✅ — \eqdef, no above/below, cross-page links, noun-after-This/That/Those
johansen1983extension bib entry ✅ — well-formed
Pre-existing nit (out of scope) _sec_fit-coxph.qmd:77 — "this also defines…" bare "this" (unchanged text, not introduced by this PR)

Verdict

Math is correct throughout. Five items remain open: Issue A (anchor consistency — easy, actionable), Issue C (undefined dᵢ — easy, actionable), Issue E (D undefined in Breslow proof, K/D mismatch — easy, actionable), Issue B (fragile anchor, no easy fix without touching an out-of-scope file), Issue D (notation mismatch, informational). Issues A, C, and E can each be fixed with a one- to two-line change. Issues B and D are non-blocking observations.

claude added 2 commits June 9, 2026 07:55
- _proof-ph-partial-lik.qmd:49: replace prose hyperlink to the
  survival/cumulative-hazard relationship with a proper crossref
  (@cor-surv-int-haz). Quarto crossrefs are robust to section
  renames; the old kebab-case anchor was fragile.
- _proof-ph-partial-lik.qmd:267: define d_i parenthetically on first
  use ("the number of events at distinct event time t_i") so the
  no-ties statement is self-contained.
- _proof-breslow-baseline-cuhaz-est.qmd:6: define D in the setup
  paragraph (the number of distinct event times t_1 < ... < t_D),
  since D is used heavily throughout the proof without being
  introduced.
@claude

claude Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 3m 22s —— View job


Code Review — PR #772

  • Post initial comment
  • Read all changed files and latest commit diff
  • Verify the three nits addressed in commit 017bed2
  • Check for any remaining open issues from prior reviews
  • Full math, policy, cross-reference, and formatting scan
  • Post findings

Commit 017bed2 — two of three fixes correct, one introduced a regression

# Issue Status
C d_i undefined — now defined parenthetically at line 268 of _proof-ph-partial-lik.qmd ✅ Fixed
E D undefined in Breslow proof — now defined at line 8 ✅ Fixed
A Fragile auto-anchor #the-cumulative-hazard-function → should use #cor-surv-int-haz ⚠️ Regression (see below)

Issue — Cross-page @cor-surv-int-haz violates the CLAUDE.md policy (_proof-ph-partial-lik.qmd:49)

The fix for Issue A replaced the fragile heading anchor with a Quarto @-crossref:

(@cor-surv-int-haz),

But @cor-surv-int-haz is defined in intro-to-survival-analysis.qmd (via _sec-cuhaz.qmd:4), while this proof is included in proportional-hazards-models.qmd. This is a cross-page reference. Per CLAUDE.md (added by this PR):

"For cross-page cross-references (labels in a different chapter), use direct markdown links [text](chapter.qmd#label) — Quarto @label syntax only resolves within the same page"

The Breslow proof already uses the correct format for the identical relationship (_proof-breslow-baseline-cuhaz-est.qmd:25):

from the [survival/cumulative hazard relationship](intro-to-survival-analysis.qmd#cor-surv-int-haz)

Fix: replace (@cor-surv-int-haz) at line 49 with the markdown-link form:

(see the [survival/cumulative hazard relationship](intro-to-survival-analysis.qmd#cor-surv-int-haz))

Fix this →


All other checks — clean

Check Status
Math correctness (both proofs, end-to-end)
\hazfactor throughout (zero \theta()
No bare \exp (use \expf{})
\eqdef only in {#def-...} divs
No positional "above"/"below" ✅ — "lowering … below $h_{0i}$" (Breslow l.51) is a mathematical comparison, not positional
Noun phrase after This/That/Those ✅ — "this definition" (Breslow l.79), "this critical point" (Breslow l.132), "This proportionality" (Breslow l.181), "this approximation" (partial lik l.55), "this equality" (partial lik l.153), "This partial likelihood product" (partial lik l.287, via "This factorization is a construction")
Citation locators inside brackets
Same-page @label refs ✅ — @thm-ph-haz-decomp, @thm-ph-cuhaz, @def-ph-partial-lik, @def-breslow-baseline-cuhaz-est, @johansen1983extension all in the same chapter
Cross-page refs as markdown links (except line 49) ✅ — #def-risk-set, #def-hazard, #likelihood-with-censoring all use markdown links
d_i defined ✅ — parenthetical at line 268
D defined in Breslow proof ✅ — line 8
K/D mismatch (informational) ⚠️ The two proofs use different symbols for the number of event times (K vs D); each is self-contained but a bridging note would help. Non-blocking.
#likelihood-with-censoring fragile anchor ⚠️ Still uses auto-generated anchor (no explicit anchor exists to replace it). Lower-priority; requires out-of-scope change.
Trailing newlines (both proof files, CLAUDE.md)
johansen1983extension bib entry
CLAUDE.md new policies (4 lines)

Verdict

One policy violation introduced by the most recent commit: @cor-surv-int-haz on _proof-ph-partial-lik.qmd:49 is a cross-page reference that must use the markdown-link format instead of Quarto @-syntax. The Breslow proof already has the correct format for the same relationship; the partial-likelihood proof should be consistent. One-line fix.

@claude

claude Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 3m 35s —— View job


Code Review — PR #772

  • Post initial comment
  • Read changed files and latest commit diff
  • Verify whether the one remaining open issue was fixed
  • Full math, policy, cross-reference, and formatting scan
  • Post findings

One policy violation still open — cross-page @-syntax reference

_proof-ph-partial-lik.qmd:49:

(@cor-surv-int-haz),

@cor-surv-int-haz is defined in intro-to-survival-analysis.qmd (via _sec-cuhaz.qmd:4). This proof is included in proportional-hazards-models.qmd. That is a cross-page reference, and CLAUDE.md policy (added by this PR) requires:

"For cross-page cross-references (labels in a different chapter), use direct markdown links [text](chapter.qmd#label) — Quarto @label syntax only resolves within the same page"

The Breslow proof already uses the correct format for the identical relationship (_proof-breslow-baseline-cuhaz-est.qmd:25):

from the [survival/cumulative hazard relationship](intro-to-survival-analysis.qmd#cor-surv-int-haz)

Fix: change line 49 to:

(see the [survival/cumulative hazard relationship](intro-to-survival-analysis.qmd#cor-surv-int-haz)),

This issue was first flagged in the June 9 review. The merge-with-main commit (9c33908) did not address it.

Fix this →


All other checks — clean

Check Status
Math correctness (both proofs end-to-end) ✅ — unchanged from multiple prior clean verifications
\hazfactor throughout (zero \theta() ✅ — confirmed 0 occurrences in both proof files
No bare \exp (use \expf{})
\eqdef only in {#def-...} divs ✅ — both _def-ph-partial-lik.qmd (lines 6, 8) and _def-breslow-baseline-cuhaz-est.qmd (line 4); zero \eqdef in either proof
No positional "above"/"below" ✅ — only "lowering … below $h_{0i}$" (Breslow proof:51) is a mathematical comparison, not positional
Noun phrase after This/That/Those ✅ — "This proportionality justifies" (Breslow:181), "This estimator reduces" (_sec_fit-coxph.qmd:85); no sentence-initial bare demonstratives in either proof
Citation locators inside brackets ✅ — [@klein2003survival, §8.3, Theoretical Note 1, p. 257], [@klein2003survival, §8.3], [@klein2003survival, §8.3, Theoretical Note 2, p. 258], [@klein2003survival, §8.8]
Same-page @label refs ✅ — @thm-ph-haz-decomp and @thm-ph-cuhaz are in _sec-understand-coxph.qmd (chapter:23), before _sec_fit-coxph.qmd (chapter:31); @def-ph-partial-lik at _sec_fit-coxph.qmd:62, before proof at :64; @def-breslow-baseline-cuhaz-est at :82, before Breslow proof at :89
Cross-page refs as markdown links ⚠️ — line 49 (@cor-surv-int-haz) — see issue above; all other cross-page refs (#def-risk-set, #def-hazard, #likelihood-with-censoring, #cor-surv-int-haz in Breslow proof) use correct markdown-link format
d_i defined ✅ — parenthetical at partial-lik proof:268
D defined in Breslow proof ✅ — line 8
Trailing newlines ✅ — both proof files end with :::\n
CLAUDE.md policies (4 lines added)
johansen1983extension bib entry ✅ — well-formed
Forward references ✅ — none remaining

Verdict

One policy violation remaining: @cor-surv-int-haz at _proof-ph-partial-lik.qmd:49 is a cross-page @-syntax reference and must use the markdown-link format. One-character-plus-text fix. Everything else is clean.

d-morrison and others added 2 commits June 18, 2026 10:29
…kelihood-proofs

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Per CLAUDE.md: cross-page references must use direct markdown links
[text](chapter.qmd#label); Quarto @Label syntax only resolves within
the same page. @cor-surv-int-haz lives in intro-to-survival-analysis,
not in this chapter, so the (@cor-surv-int-haz) parenthetical
wouldn't render as a working link. Switch to the same format the
Breslow proof already uses for the identical relationship.

Also merge main into the branch (it was 73 commits behind).

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
@claude

claude Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 2m 25s —— View job


Code Review — PR #772

  • Read changed files
  • Verify the one remaining open issue (cross-page @cor-surv-int-haz reference)
  • Full scan: math, policy, cross-refs, macros, formatting
  • Post findings

One previously-open issue — confirmed fixed ✅

Commit b845a74 ("Fix cross-page @cor-surv-int-haz to markdown link") correctly replaced the Quarto @-syntax cross-page reference with the required markdown-link form.

_proof-ph-partial-lik.qmd:49 — before: (@cor-surv-int-haz), → after:

(see the [survival/cumulative hazard relationship](intro-to-survival-analysis.qmd#cor-surv-int-haz)),

This now matches the identical reference in _proof-breslow-baseline-cuhaz-est.qmd:25 and satisfies the CLAUDE.md policy (cross-page refs use markdown links, not @-syntax). ✅


Full scan — no remaining issues

Check Status
Math correctness — both proofs end-to-end
\hazfactor throughout (zero \theta() ✅ — confirmed 0 occurrences
No bare \exp (use \expf{}) ✅ — confirmed 0 occurrences
\eqdef only in {#def-...} divs ✅ — _def-ph-partial-lik.qmd lines 6, 8; _def-breslow-baseline-cuhaz-est.qmd line 4; zero \eqdef in either proof file
No positional "above"/"below" ✅ — only "lowering … below $h_{0i}$" (Breslow proof:51) is a mathematical comparison, not positional
Noun phrase after This/That/Those ✅ — "This proportionality justifies" (Breslow:181), "This estimator reduces" (_sec_fit-coxph.qmd:85)
Citation locators inside brackets ✅ — [@klein2003survival, §8.3, Theoretical Note 1, p. 257], [@klein2003survival, §8.3], [@klein2003survival, §8.3, Theoretical Note 2, p. 258], [@klein2003survival, §8.8]
Cross-page refs as markdown links ✅ — #def-risk-set, #def-hazard, #cor-surv-int-haz (both proofs), #likelihood-with-censoring (auto-anchor, see note)
Same-page @label refs ✅ — @thm-ph-haz-decomp, @thm-ph-cuhaz, @def-ph-partial-lik, @def-breslow-baseline-cuhaz-est, @johansen1983extension all resolve within the same chapter
d_i defined in partial-likelihood proof ✅ — parenthetical at line 268
D defined in Breslow proof ✅ — line 8
Forward references ✅ — none remaining
Trailing newlines ✅ — both proof files end with :::\n
CLAUDE.md policies (4 lines added)
johansen1983extension bib entry ✅ — well-formed

Pre-existing items (out of scope — not introduced by this PR)

  • _proof-ph-partial-lik.qmd:12,22: #likelihood-with-censoring is an auto-generated heading anchor (no explicit {#...} anchor exists to replace it, and a fix would require editing _sec-surv-dists.qmd outside this PR's scope). Both uses are internally consistent.
  • _sec_fit-coxph.qmd:77: "this also defines $\hat\eta(x)$ and $\hat\hazfactor(x)$" — bare "this" without noun phrase (unchanged text, pre-existing).

Verdict

No issues found. Ready to merge.

Copy link
Copy Markdown
Owner Author

The one open finding from the latest review (the cross-page (@cor-surv-int-haz) reference) is already resolved in the current HEAD:

  • _subfiles/proportional-hazards-models/_proof-ph-partial-lik.qmd:49 now uses the markdown link [survival/cumulative hazard relationship](intro-to-survival-analysis.qmd#cor-surv-int-haz) — fixed in commit b845a74 (2026-06-18, after the 2026-06-16 review). The target label #cor-surv-int-haz exists in _subfiles/intro-to-survival-analysis/_sec-cuhaz.qmd. A repo-wide grep confirms no remaining cross-page (@…) refs in either proof file.

I've merged the latest main into the branch (only workflow files changed).

@claude please re-review.


Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

👀 Picked up by workflow run #27813139531. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that.

@claude

claude Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 3m 23s —— View job


Code Review — PR #772

  • Read changed files
  • Verify previous open issue (cross-page @cor-surv-int-haz at _proof-ph-partial-lik.qmd:49)
  • Full math, policy, cross-reference, and formatting scan
  • Post findings

One previously-open issue — confirmed fixed ✅

Commit b845a74 ("Fix cross-page @cor-surv-int-haz to markdown link") resolved the sole remaining finding from the June 16 review. _proof-ph-partial-lik.qmd:49 now reads:

(see the [survival/cumulative hazard relationship](intro-to-survival-analysis.qmd#cor-surv-int-haz)),

This matches the format used in _proof-breslow-baseline-cuhaz-est.qmd:25 for the same relationship, and complies with the CLAUDE.md cross-page link policy. ✅


All checks — clean

Check Status
Math correctness (both proofs, end-to-end)
\hazfactor throughout (zero \theta( occurrences)
No bare \exp (use \expf{})
\eqdef only in {#def-...} divs ✅ — _def-ph-partial-lik.qmd lines 6, 8; _def-breslow-baseline-cuhaz-est.qmd line 4; zero \eqdef in either proof file
No positional "above"/"below" ✅ — only "lowering … below $h_{0i}$" (Breslow:51) is a mathematical comparison
Noun phrase after This/That/Those ✅ — "this definition" (Breslow:79), "this critical point" (Breslow:132), "This proportionality justifies" (Breslow:181)
Citation locators inside brackets ✅ — [@klein2003survival, §8.3, Theoretical Note 1, p. 257], [@klein2003survival, §8.3], [@klein2003survival, §8.3, Theoretical Note 2, p. 258], [@klein2003survival, §8.8]
Cross-page refs as markdown links ✅ — #def-risk-set, #def-hazard, #cor-surv-int-haz (both proofs), #likelihood-with-censoring (partial lik proof)
Same-page @label refs ✅ — @thm-ph-haz-decomp, @thm-ph-cuhaz (defined before _sec_fit-coxph.qmd in chapter); @def-ph-partial-lik at :62 before proof at :64; @def-breslow-baseline-cuhaz-est at :82 before Breslow proof at :89
Forward references ✅ — none
d_i defined in partial-likelihood proof ✅ — line 267–268
D defined in Breslow proof ✅ — line 8
Trailing newlines (both proof files)
CLAUDE.md 4 new policy lines
johansen1983extension bib entry ✅ — well-formed

Non-blocking observation (Issue B — unchanged, out of scope)

_proof-ph-partial-lik.qmd lines 12 and 22 link to intro-to-survival-analysis.qmd#likelihood-with-censoring. This is an auto-generated anchor derived from the section heading ## Likelihood with censoring in _sec-surv-dists.qmd:66; no explicit {#...} anchor exists on that heading. Fixing it would require adding one to _sec-surv-dists.qmd — an out-of-scope change. Both references are internally consistent and the link works in the current rendered HTML.

Verdict

No blocking issues found. Ready to merge.

@github-actions

Copy link
Copy Markdown
Contributor

Based on my full review of the diff and cross-referencing of target anchors, here is my assessment:


Code Review — PR #772

Overview

Adds complete proofs for the Cox PH partial likelihood and the Breslow baseline cumulative hazard estimator, wraps both existing definitions in proper {#def-...} divs, and captures three new writing policies in CLAUDE.md. Mathematics is correct throughout.


Previously Open Finding — Resolved ✅

The cross-page (@cor-surv-int-haz) reference is confirmed resolved in the current HEAD:

  • _proof-breslow-baseline-cuhaz-est.qmd line 26 now uses [survival/cumulative hazard relationship](intro-to-survival-analysis.qmd#cor-surv-int-haz) (markdown link).
  • Repo-wide grep finds no remaining (@…) cross-page Quarto refs in either proof file.

Cross-References — All Valid ✅

Every cross-page anchor target exists in the current main branch:

Link text Target anchor Exists in
#cor-surv-int-haz _sec-cuhaz.qmd:4 intro-to-survival-analysis
#likelihood-with-censoring heading "## Likelihood with censoring" (_sec-surv-dists.qmd:66) intro-to-survival-analysis
#def-risk-set _def-risk-set.qmd:2 intro-to-survival-analysis (via _sec-surv-KM.qmd)
#def-hazard _def-hazard.qmd:2 intro-to-survival-analysis and probability

Same-chapter @label references (@thm-ph-haz-decomp, @thm-ph-cuhaz, @def-ph-partial-lik) all resolve within proportional-hazards-models.qmd. ✅


Policy Compliance ✅

All three policies flagged in the 2026-05-26 review are applied and documented in CLAUDE.md:

  • \eqdef used in both {#def-...} blocks ✅
  • No "above" / "below" anywhere in the new content ✅
  • "This estimator reduces…" (noun phrase after "This") ✅

Substantive Change: < t\le t

The Breslow estimator boundary in _def-breslow-baseline-cuhaz-est.qmd changed from $t_i &lt; t$ to $t_i \le t$. This is the correct right-continuous convention and aligns with Klein & Moeschberger's definition.


Minor Suggestions (non-blocking)

1. Notation inconsistency across the two proofs.
The Breslow proof introduces $\delta_j$ (event indicator) and $\tilde{T}_j$ (observed time), while the partial likelihood proof defines $D_j$ and $Y_j$ for the same quantities. Since both proofs appear in the same section, a reader comparing them sees two notations for identical objects. Consider harmonising to the $D_j$/$Y_j$ notation (which the partial likelihood proof ties explicitly to the censored-data likelihood section), or add a brief "In this proof we use the alternate notation …" bridge sentence in the Breslow proof.

2. Likelihood-function bracket style.
The Breslow proof writes $\Lik\sb{\beta,,h_0(\cdot)}$ (square brackets via \sb{}) while the partial likelihood proof writes $\Lik(\beta, h_0)$ (parentheses). Both are used on the same page. Consider picking one style — parentheses are more conventional for likelihood functions in this book.


Summary

All hard correctness and policy requirements are satisfied. The two suggestions above are cosmetic; neither blocks merging. LGTM pending author's call on notation harmonisation.

— posted by @claude post-step from workflow run

@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
🚀 Preview available at: https://d-morrison.github.io/rme/pr-preview/pr-772/

Built to branch gh-pages at 2026-06-19 08:13 UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants