Skip to content

Weibull delay support + distspec alignment (0.2.0) - #26

Merged
sbfnk merged 4 commits into
mainfrom
weibull-and-distspec
Jul 27, 2026
Merged

Weibull delay support + distspec alignment (0.2.0)#26
sbfnk merged 4 commits into
mainfrom
weibull-and-distspec

Conversation

@sbfnk-bot

Copy link
Copy Markdown
Collaborator

Prepares the 0.2.0 release, folding in Weibull delay support (per the discussion) and aligning with the soon-to-release distspec.

Weibull delays

fit_cfr() and simulate_linelist() now accept a Weibull() onset-to-death (and recovery) delay, alongside LogNormal() and Gamma(). The Stan cure model is family-agnostic (it reads brms's parameterisation and gets the delay CDF from primarycensored's dist_id), so no new Stan code was needed — the work is R-side:

  • .assert_delay_family(): allow weibull.
  • .delay_family_prior(): map distspec's (shape, scale) to brms's (mu = mean, shape) via .weibull_mu_prior() (mean = scale·Γ(1+1/shape), delta-method uncertainty) — the analogue of the existing gamma reparameterisation. Refactored the family branch to a switch().
  • sample_delay(): rweibull. .delay_moments(): Weibull mean/sd.

Verified end-to-end: a Weibull fit recovers the CFR (0.398, 95% CrI covers 0.4) and delay mean (11.0, covers the true 11.7), all rhat < 1.05.

distspec alignment

distspec now exports natural_params(), which cfrnow reimplemented privately as delay_native_order(). Adopted natural_params(delay) (dispatch on the object) and removed R/utils.R. cfrnow's full suite already passes against the new distspec; this just tracks the public API.

Release

Version → 0.2.0; NEWS rolled into a 0.2.0 section (Weibull, distspec, stratified vignette, plus the existing pp_check/ascertainment/grouped-CFR entries).

Post-merge (separate steps): tag 0.2.0, add cfrnow to the epiforecasts r-universe registry, then update the README install instructions.

Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
@sbfnk-bot
sbfnk-bot requested a review from sbfnk July 17, 2026 20:20
Comment thread tests/testthat/test-fit_cfr.R
@sbfnk-bot sbfnk-bot added the llm-reviewed Reviewed by the wait-for-review loop label Jul 17, 2026
sbfnk-bot and others added 3 commits July 17, 2026 23:04
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
@sbfnk
sbfnk marked this pull request as ready for review July 21, 2026 07:31
@sbfnk
sbfnk merged commit b7309ec into main Jul 27, 2026
6 checks passed
@sbfnk
sbfnk deleted the weibull-and-distspec branch July 27, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm-reviewed Reviewed by the wait-for-review loop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants