Add forced EIR feature#387
Draft
pwinskill wants to merge 1 commit into
Draft
Conversation
Add set_forced_eir() to drive infectious bites directly from a user-supplied, time-varying EIR, bypassing the simulated mosquito population while preserving the overdispersed distribution of bites among individuals. - New set_forced_eir() helper (per-adult EIR, matching set_equilibrium's default init_EIR convention) with a step-function time series - simulate_bites() overrides the per-species EIR and skips the mosquito-only work when force_EIR is set - Mosquito ODE stepping and mosquito-state outputs are disabled under a forced EIR; interventions are permitted (with a warning) and act directly on humans - Not supported for metapopulation simulations - Tests and a Forced-EIR vignette Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Adds an option to bypass the simulated mosquito component and drive infectious bites directly from a user-supplied, time-varying EIR, while preserving the overdispersed distribution of bites among individuals (age biting
psi× individual heterogeneityzeta).Useful when transmission intensity is a known/prescribed input (fitting to an observed EIR series, forcing counterfactual scenarios) rather than an emergent property of vector dynamics.
API
set_forced_eir(parameters, timesteps, eir)— new exported helper. EIR is a step function in infectious bites per adult person per year, the same per-adult convention asset_equilibrium()'s defaultinit_EIR, so forcingEIR = Xreproduces aset_equilibrium(init_EIR = X)run. Split across species by biting proportion. Emits a warning that the EIR is applied directly.How it works
simulate_bites()overrides the per-speciesspecies_eirviaforced_species_eir()and wraps the mosquito-only work (infectious counts, FOIM, mu, ODE/individual-mosquito updates) in a!force_EIRguard. The existingrpois+fast_weighted_sample(lambda)machinery is reused unchanged, so overdispersion is preserved.EIR_*,n_bittenand all human outputs remain whileE/L/P/Sm/Pm/Imcounts,total_M,FOIM_*andmu_*are omitted.Interactions
set_carrying_capacity) are inert.Testing
tests/testthat/test-forced-eir.R(53 assertions): unit tests for the helper/lookup/conversion, a low-EIR consistency check against a matched equilibrium run (validates the per-adult unit convention), multi-species split, vivax, individual-mosquitoes gating, warning behaviour, and process wiring.vignettes/Forced-EIR.Rmd.Notes for reviewers
Reviewed by independent code-correctness and epidemiology passes; the key finding (per-adult vs population-average unit convention) was fixed by aligning
forced_species_eir()withset_equilibrium'scalculate_population_to_adult_EIR_scalar.🤖 Generated with Claude Code