Skip to content

Add survival-function estimator macros (empirical, KM, Nelson-Aalen) - #76

Merged
d-morrison merged 1 commit into
mainfrom
claude/issue-75-rme-epi204-iruw13
Jul 3, 2026
Merged

d-morrison merged 1 commit into
mainfrom
claude/issue-75-rme-epi204-iruw13

Conversation

@d-morrison

Copy link
Copy Markdown
Owner

Summary

  • Closes create macros for common survival function estimators #75.
  • Adds \emp, \km, \naa as small composable subscript-label macros for the empirical, Kaplan-Meier, and Nelson-Aalen estimator names.
  • Composes them onto the existing \hsurv (hat-S) macro to define \hsurvemp, \hsurvkm, \hsurvnaa, so the hat lands only over S and the estimator name appears as a subscript (e.g. \hsurvkm renders as $\hat{S}_{\text{KM}}$), matching the example in the issue.
  • Adds the one-argument function-call variants \hsurvempf, \hsurvkmf, \hsurvnaaf (e.g. \hsurvkmf{t} → $\hat{S}_{\text{KM}}(t)$), following the existing \hSurvf pattern.
  • Adds matching entries to interpretations.tsv for all nine new macros (required by macros-table.qmd's build-time completeness check).

Notes

  • Placed the new macros right after the existing \hsurv/\hSurv/\hSurvf block in macros.qmd, since that's the natural home for hat-S-estimator macros.
  • Did not reuse the existing \NA macro (already means "not-available" placeholder) for the Nelson-Aalen label — \naa is a distinct, case-sensitive command name, so there's no collision.
  • Did not define un-hatted "population" versions (e.g. \survkm) since KM/NA/empirical are inherently sample-based estimators, not estimands.

Test plan

  • Verified interpretations.tsv has no missing entries for any macro in macros.qmd (replicated the macros-table.qmd completeness check via a standalone R script, since this sandbox's R installation is missing rmarkdown/sass build tooling and couldn't run a full quarto render).
  • Verified brace-balance / syntax of all new \def/\providecommand lines.
  • Full quarto render of macros-table.qmd, demo-include-in-header.qmd --to pdf, and demo-shortcode.qmd --to pdf per CONTRIBUTING.mdnot run, this sandbox lacks a working R/LaTeX toolchain (rmarkdown's sass dependency fails to build, no pdflatex). Recommend a maintainer or CI run these before merge.

Generated by Claude Code

Define \emp, \km, \naa as composable estimator-label subscripts, then
build \hsurvemp, \hsurvkm, \hsurvnaa (and function-call variants) on
top of the existing \hsurv estimator macro so the hat lands only on S,
per issue #75.
Copilot AI review requested due to automatic review settings July 3, 2026 05:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a small, composable set of survival-function estimator label macros (\emp, \km, \naa) and uses them to define hatted survival estimator macros with subscripts (plus function-call variants), along with the required interpretation-table entries so documentation generation remains complete.

Changes:

  • Added estimator label sub-macros (\emp, \km, \naa) and composed survival estimator macros (\hsurvemp, \hsurvkm, \hsurvnaa).
  • Added one-argument “function call” variants (\hsurvempf, \hsurvkmf, \hsurvnaaf) consistent with existing ...f patterns.
  • Added interpretation entries for all new macros to satisfy the macros-table completeness check.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
macros.qmd Defines new survival estimator label macros and composed \hsurv... estimator macros (including ...f call variants).
interpretations.tsv Adds interpretation rows for the nine new macros so the macro reference table build remains complete.

Comment thread macros.qmd
@d-morrison
d-morrison merged commit dcac8c5 into main Jul 3, 2026
6 checks passed
@d-morrison
d-morrison deleted the claude/issue-75-rme-epi204-iruw13 branch July 3, 2026 06:33
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.

d-morrison added a commit to d-morrison/rme that referenced this pull request Jul 4, 2026
* Use new survival-estimator macros for KM/Nelson-Aalen notation

Replace ad hoc \hat{S}_{KM}(t)/\hat{S}_{NA}(t)-style LaTeX with the
\hsurvkmf{}/\hsurvnaaf{} macros added in d-morrison/macros#76 (issue
d-morrison/macros#75), across the KM/NA estimator definitions,
derivations, exercises, and the competing-risks and midterm-review
chapters. Bumps the latex-macros submodule to pick up the new macros.

* Point latex-macros submodule at merged main (macros#76)

Re-points from the macros#76 branch commit to main now that it has
merged.

* Rename to shortened survival-estimator macros (hskmf, hsnaaf, etc.)

Follows the rename in d-morrison/macros#77: \hsurvkmf -> \hskmf,
\hsurvnaaf -> \hsnaaf, and the corresponding zero-arg/emp forms.
Bumps latex-macros to pick up the rename.

* Point latex-macros submodule at merged main (macros#77)

Re-points from the macros#77 branch commit to main now that it has
merged.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create macros for common survival function estimators

3 participants