Run the entomological model across multiple parameter sets
Source:R/interventions.R
run_interventions.RdFully vectorised runner: evaluates the entomological model for
every combination of intervention parameter set, coverage value, and
(optionally) vector parameter draw. All param_sets × coverage
combinations are evaluated in a single matrix call to
eval_entomological_model() per timepoint per draw, avoiding
per-row R loop overhead and scaling efficiently to tens of thousands of
parameter sets.
Two model structures are supported and are mutually exclusive. The
model is auto-detected from param_sets:
Standard (3-host): no
killing_during_host_seeking_absolutecolumn (or all valuesNA). Usesdeterrency,preprandial,postprandial.Dummy-host (4-host):
killing_during_host_seeking_absolutecolumn present with at least one non-NAvalue. Usesdeterrency,killing_during_host_seeking_absolute,postprandial.preprandialmust be0for all rows.
Usage
run_interventions(
param_sets,
model_p,
coverage_vec,
vec_param_sets = NULL,
interv_param_sets = NULL,
exposure_sets = NULL,
coverage_sets = NULL,
duration_years = 3,
insecticide_decay = TRUE,
exposure = 1,
keep_time = FALSE
)Arguments
- param_sets
Data frame where each row defines one parameter set. Required columns:
deterrency: initial deterrency efficacy in[0,1]preprandial: initial pre-prandial killing efficacy in[0,1](set to0for the dummy-host model)postprandial: initial post-prandial killing efficacy in[0,1]halflife_attrition: attrition decay parameterL(days): half-life for Weibull / exponential / Hill, time to zero for linear / step / smooth-compact (the column can be omitted when every row hasdecay_attrition = "none")shape_attrition: attrition decay shape parameter (required for Weibull / Hill / smooth-compact;NAor omitted otherwise)decay_attrition: decay shape string (seedecay_function())
Optional columns:
name: label of the parameter set (used byplot_impact()); any other column is also carried to the output.killing_during_host_seeking_absolute: activates the dummy-host (4-host) model; absolute availability of the dummy host (seeKillingDuringHostSeekingAbsoluteinbuild_intervention()). Non-missing values must be finite and non-negative;NAmeans inactive.halflife_det,halflife_pre,halflife_post,halflife_hsk: per-component linear insecticide decay (years); despite the name, the time at which the effect reaches zero (seehalflife_insecticideinbuild_intervention()).halflife_hskapplies tokilling_during_host_seeking_absolutein dummy-host mode.decay_det,L_det,kappa_det(and equivalently_pre,_post,_hsk): general per-component decay function,L(days; meaning depends on the shape, seedecay_function()), and shape._hskcontrols the decay ofkilling_during_host_seeking_absolute. Overrides the correspondinghalflife_*column whenever a shape is specified. Constant shapes need noL_*orkappa_*; other shapes require their parameters (incomplete specifications raise an error).
- model_p
Model object from
build_model_obj().- coverage_vec
Non-empty numeric vector of finite deployment coverages in
[0,1]. Coverage0is used internally as the no-intervention baseline for computingavg_impact; it is added automatically if not present, and the corresponding row is included in the output only when explicitly supplied.- vec_param_sets
Optional data frame of vector parameter draws (same columns as
vec_ent_param). Each row is one draw. Adds adrawcolumn to the output.- interv_param_sets
Optional data frame with
n_drawrows and the same columns asparam_sets. Rowdreplacesparam_setsfor drawd. A list ofn_drawsingle-row data frames is also accepted for backward compatibility.- exposure_sets
Optional numeric vector (or list) of
n_drawexposure factors; each replacesexposurefor that draw, e.g. to propagate uncertainty in activity patterns viacalculate_exposure().- coverage_sets
Optional list of
n_drawcoverage vectors; each replacescoverage_vecfor that draw.- duration_years
Single finite positive duration in years (one time point per day, with at least one point). Default 3 years.
- insecticide_decay
Logical (default
TRUE). IfFALSE, the per-component insecticide decay columns (halflife_*,decay_*,L_*,kappa_*) are ignored: efficacies keep their initial (e.g. unwashed) values and only attrition decays.- exposure
Proportion of human exposure to bites that occurs where the intervention protects, in
[0, 1](default 1). The intervention acts on an effective coveragecoverage * exposure. Typicallycalculate_exposure(...)$Exposure_Indoor_whileinbedfor ITNs, and$indoor_restingor$Exposure_Indoor_totalfor IRS (seecalculate_exposure).- keep_time
Logical (default
FALSE): also return the vectorial capacity and impact on each day (memory-heavy for large sweeps).
Value
A data.table with one row per
(parameter set × coverage [× draw]). All columns of param_sets
are included; when vec_param_sets is supplied the draw-specific vector
parameter columns are appended. Output columns coverage (deployment
coverage), exposure, avg_vc, avg_impact, and (when any
uncertainty source is supplied) draw follow.
With keep_time = TRUE, a list with this table as impact and a
long data.table time with columns param_set (row of
param_sets), name (if param_sets has one),
coverage, day (0 = deployment), vc, impact and,
with uncertainty draws, draw.