Simple sim#393
Conversation
… into simple-sim
|
📖 https://ucd-serg.github.io/serocalculator/preview/pr393 |
Codecov ReportAttention: Patch coverage is
|
|
@claude resolve the merge conflicts in this pull request |
|
Claude finished @d-morrison's task in 23m 11s —— View job Resolving Merge Conflicts
What was resolvedThe Remaining potential conflictsTwo files may still require manual resolution:
To complete the merge conflict resolution for these files, you can run: git fetch origin main
git merge origin/main
# Resolve conflicts in R/graph.curve.params.R and .github/workflows/R-CMD-check.yaml
git add R/graph.curve.params.R .github/workflows/R-CMD-check.yaml
git commit
git push |
There was a problem hiding this comment.
Pull request overview
This PR expands the package’s simulation and documentation tooling around cross-sectional serosurvey incidence estimation, adding a new simulation path with unit support and updating vignettes/CI to support the new dependencies.
Changes:
- Adds
sim_pop_data_2()plus new helpers (sim_age(),sim_time_since_last_sc()) and a new exported antibody response functionab_5p(). - Substantially revises the methodology and simulation vignettes and adds citation/macro updates.
- Adds unit/snapshot tests and adjusts CI (udunits system deps) and package metadata (NAMESPACE/DESCRIPTION/NEWS/man pages).
Reviewed changes
Copilot reviewed 33 out of 47 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| vignettes/references.bib | Adds Hay et al. 2024 citation entry |
| vignettes/methodology.qmd | Major rewrite/expansion of methodology vignette content and examples |
| vignettes/articles/simulate_xsectionalData.qmd | Updates simulation article to use sim_pop_data_2() and new plotting options |
| vignettes/articles/_sec-latent-likelihood.qmd | Refactors likelihood derivation layout/notes |
| vignettes/articles/_macros.qmd | Adds LaTeX color macros (red/blue/green) |
| vignettes/articles/_antibody-response-model.qmd | Minor formatting + adds Shiny app URL |
| tests/testthat/test-sim_pop_data_2.R | Adds snapshot tests for sim_pop_data_2() (with/without units) |
| tests/testthat/test-ab_5p.R | Adds snapshot + visual regression tests for ab_5p() |
| tests/testthat/_snaps/sim_pop_data_2/sim_cs_data.csv | Snapshot artifact for non-units simulation output |
| tests/testthat/_snaps/sim_pop_data_2/sim_cs_data-units.csv | Snapshot artifact for units simulation output |
| tests/testthat/_snaps/sim_pop_data_2.md | Serialized snapshot output for sim_pop_data_2() tests |
| tests/testthat/_snaps/ab_5p/response-curve.svg | vdiffr snapshot (non-units curve) |
| tests/testthat/_snaps/ab_5p/response-curve-units.svg | vdiffr snapshot (units curve) |
| tests/testthat/_snaps/ab_5p.md | Snapshot output for ab_5p() tests |
| R/sim_time_since_last_sc.R | New helper for simulating time since last seroconversion |
| R/sim_pop_data.R | Minor doc wording tweaks |
| R/sim_pop_data_multi.R | Adds sim_function parameter to choose simulation implementation |
| R/sim_pop_data_2.R | New simulation implementation intended to support units |
| R/sim_age.R | New helper for simulating ages (with optional units) |
| R/serocalculator-package.R | Adds new imports used by new code (left_join, reframe, rexp) |
| R/graph.decay.curves.R | Improves formatting + adds units-aware xlim conversion |
| R/graph.curve.params.R | Switches to ab_5p() and adds log_x option |
| R/f_dev.r | Moves example into inst/examples/exm-f_dev.R via @example |
| R/ab_5p.R | Adds new exported 5-parameter antibody response function |
| NEWS.md | Adds release notes for methodology + units-related simulation work |
| NAMESPACE | Exports ab_5p, sim_pop_data_2; adds needed imports |
| man/sim_pop_data.Rd | Doc wording tweaks to match roxygen changes |
| man/sim_pop_data_multi.Rd | Documents new sim_function argument + wording tweaks |
| man/sim_pop_data_2.Rd | New Rd for sim_pop_data_2() |
| man/graph.curve.params.Rd | Documents new log_x argument |
| man/f_dev0.Rd | Updates rendered example formatting |
| man/ab_5p.Rd | New Rd for ab_5p() |
| inst/WORDLIST | Adds new vignette/term spellings |
| inst/examples/exm-f_dev.R | New extracted example file referenced by roxygen |
| DESCRIPTION | Version bump + adds units/quantities + adds Remotes |
| codecov.yml | Enables Codecov PR comments |
| .github/workflows/R-CMD-check.yaml | Installs udunits system deps for units/quantities builds |
| _quarto.yml | Removes auto-date field from Quarto config |
Files not reviewed (3)
- man/ab_5p.Rd: Language not supported
- man/f_dev0.Rd: Language not supported
- man/graph.curve.params.Rd: Language not supported
| add_noise = FALSE, | ||
| curve_params, | ||
| noise_limits, | ||
| format = "wide", |
| sim_time_since_last_sc( | ||
| lambda = lambda, | ||
| n_samples = n_samples, | ||
| age = .data$age |
| n_mcmc_samples = 0, | ||
| renew_params = FALSE, | ||
| add_noise = FALSE, |
| age_range = c(0, 20), | ||
| age_fixed = NA, | ||
| antigen_isos = intersect( |
| verbose = FALSE, | ||
| ...) { | ||
| if (verbose > 1) { | ||
| message("inputs to `sim_pop_data()`:") |
| if (inherits(age_range, "units")) { | ||
| age <- age |> units::as_units(units(age_range)) | ||
| } |
| #' @param shape decay power function exponent | ||
| #' [numeric] scalar; uses r > 1 scale for shape | ||
| #' | ||
| #' @returns a [numeric] [vector] |
| brew install automake udunits | ||
| echo "UDUNITS2_INCLUDE=/opt/homebrew/Cellar/udunits/2.2.28/include" >> $GITHUB_ENV | ||
| echo "UDUNITS2_LIBS=/opt/homebrew/Cellar/udunits/2.2.28/lib" >> $GITHUB_ENV |
| qrcode, | ||
| quantities, | ||
| vdiffr, | ||
| withr |
| Remotes: | ||
| r-quantities/units, | ||
| r-quantities/quantities |
Merge main's 1.4.x changes into simple-sim branch: - DESCRIPTION: update to main's v1.4.0.9011 base; add `units` to Imports - NAMESPACE: incorporate all exports/imports from both branches - NEWS.md: add main's dev section entries alongside #393-specific entries - R/serocalculator-package.R: use main's updated imports + sim-specific additions - inst/WORDLIST: merge all words from both branches Co-authored-by: Douglas Ezra Morrison <d-morrison@users.noreply.github.com>
|
Claude Code CLI (local session) is working on this — paws off until I'm done. |
|
Update: the introductory lecture slides (methodology.qmd) from this branch have been brought forward onto current main in #527 (slides only, review-clean). Claude Code CLI is done here for now — leaving this PR open for the remaining work (e.g. the units-support feature). Paws off lifted. |
Thank you for taking the time to submit a pull request!
To maximize the chances of acceptance:
Fixes #issue-number(if relevant).-.testthat).For more information see Contributing.