Weibull delay support + distspec alignment (0.2.0) - #26
Merged
Conversation
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
sbfnk-bot
commented
Jul 17, 2026
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
marked this pull request as ready for review
July 21, 2026 07:31
sbfnk
approved these changes
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()andsimulate_linelist()now accept aWeibull()onset-to-death (and recovery) delay, alongsideLogNormal()andGamma(). The Stan cure model is family-agnostic (it reads brms's parameterisation and gets the delay CDF fromprimarycensored'sdist_id), so no new Stan code was needed — the work is R-side:.assert_delay_family(): allowweibull..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 aswitch().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 asdelay_native_order(). Adoptednatural_params(delay)(dispatch on the object) and removedR/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.