Repository navigation
Serial interval from trajectory draws for shared-trajectory models - #1256
Conversation
…ory draws 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>
Benchmark comparison vs baseMinimum time per call. Buckets are PR time as a % of base, so lower is faster (🟢 faster, ⚪ within 5%, 🔴 slower). Counts of benchmarks per bucket:
Evaluation — 19 benchmarks (by time change)
AD gradients — 0 benchmarks (by time change)none |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1256 +/- ##
=======================================
Coverage 97.81% 97.81%
=======================================
Files 104 104
Lines 11806 11833 +27
=======================================
+ Hits 11548 11575 +27
Misses 258 258
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
|
Merged origin/main. Main had added a note and error text saying |
serial_interval(model, infector, infectee)now works for a model whose attributes record onset without anonset_law(a builder drawing a within-host trajectory), including a kernel that depends on the individual, such as aHazardKernelon the load. It returns a mixture overn_trajectoriesdraws of the attributes (keywordsn_trajectories = 200andrng). Each draw contributes its kernel conditioned on a contact, shifted by minus its own onset, and weighted by the chance of a contact, so high-load draws count for more. The infectee's incubation period comes from an independent draw. Draws with no onset are left out, as inrealised_serial_intervals. Models withclinical_presentationand a fixed generation time keep the existing convolution path.An onset drawn in the builder alongside the trajectory is sampled jointly with it, one per draw. Interventions are not applied, and the offspring law must be a fixed distribution.
The new test compares the mixture's CDF with
realised_serial_intervalsfrom 4000 simulated outbreaks, for aHazardKernelon the load and for an exponential generation time with trajectory-driven onset, at five points (tolerance 0.025). Onlytest/test_serial_interval.jlwas run.Closes #1254. Builds on #1223.
This PR closes #1254.