Per-distribution S3 interface: migrate gamma (PoC for #41)#43
Per-distribution S3 interface: migrate gamma (PoC for #41)#43sbfnk-bot wants to merge 3 commits into
Conversation
First slice of #41: adds new_dist() dispatch objects and the distribution interface (dist_natural_params, dist_cdf, mean, sd), with gamma migrated into R/gamma.R. The gamma arms of the discrete_pmf/natural_params/mean/sd switches now delegate; all other distributions unchanged. Behaviour-preserving (tests green, 0 lints). Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR introduces a new distribution dispatch interface ( ChangesGamma distribution dispatch interface
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Proof-of-concept for the per-distribution refactor (#41, first checklist box). It introduces the dispatch machinery and migrates
gammaonly, so we can see the pattern (and review) on something small before doing the rest.What it does
R/distribution.R—new_dist(name, params)dispatch objects + the interface generics (dist_natural_params,dist_cdf, plus reuse of the existingmean/sdgenerics). Discretisation is an optional capability (dist_cdf.defaulterrors), not a type split.R/gamma.R— everything gamma in one file:dist_natural_params.gamma,dist_cdf.gamma,mean.gamma,sd.gamma.gammaarms of thediscrete_pmf(pdist),natural_params,mean.dist_specandsd.dist_specswitches now delegate to those methods. Every other distribution is untouched.Notes / scope
lint_package()= 0.mean/sd/natural_params/discretisefor gamma verified identical.mean/sdare used directly (they're generics);natural_params's own dispatch and the stored-component representation change are deliberately deferred.switchcollapses to a single<generic>(new_dist(distribution))call and disappears — andR/template.R+ the "how to add a distribution" doc follow.Draft, for design feedback on the shape before the remaining distributions.
Summary by CodeRabbit
New Features
Bug Fixes