| Title: | A Disease Model for Chlamydia in Koalas |
|---|---|
| Description: | The koalas package is intended to be used for exploring chlamydia control programmes. The package is still being developed, and feedback is welcomed! |
| Authors: | Matt Denwood [aut, cre] |
| Maintainer: | Matt Denwood <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.5.0-1 |
| Built: | 2026-05-21 08:58:24 UTC |
| Source: | https://github.com/ku-awdc/koalas |
Assess different intervention strategies
assess_interventions( koala_model, years, frequency = c(1, 2, 3, 4), prop_active = seq(0, 1, by = 0.05), prop_targeted = 0, cl = NULL, ... )assess_interventions( koala_model, years, frequency = c(1, 2, 3, 4), prop_active = seq(0, 1, by = 0.05), prop_targeted = 0, cl = NULL, ... )
koala_model |
a valid |
years |
the number of years to update the model (passed to the run method of the |
frequency |
a vector of annual sampling frequencies to test |
prop_active |
a vector of the proportion of animals to test/treat/vaccinate with active sampling at each intervention |
prop_targeted |
a vector of the proportion of diseased animals to treat with targeted interventions at each intervention |
cl |
passed to |
... |
additional arguments (cull proportions) passed to the active_intervention method of the |
a data frame of final prevalence and population size values at the end of each simulation for each combination of frequency and proportion
This is a within-group SVIDR(D) model class that can either be run on its own or embedded in a between-group model. Note: D is not a real state (and can be negative), it is just used to ensure that the books are balanced including birth/death
Snumber of susceptible animals
Itotal number of infected animals
Dnumber of diseased animals
Rnumber of recovered animals
Vnumber of vaccinated animals
Ctpcumulative number of animals removed as true positives on active/passive sampling
Cfpcumulative number of animals removed as false positives on active/passive sampling
mortality_naturalmortality rate from natural causes
mortality_diseasemortality rate from disease
carrying_capacitynumber of animals supported by the population (can be Inf or NA)
birth_ratebirth rate
relative_fecundityfecundity of diseased animals relative to other states (S/I/R/V)
betathe transmission rate parameter per unit time (must be positive)
sigmathe progression rate from I to D or S
acute_recovery_probthe probability that a progression from I will go to S rather than D
recoverythe recovery rate parameter per unit time (must be positive)
waning_naturalthe immune waning rate from R (following natural infection)
waning_vaccinethe immune waning rate from V (following vaccination)
timethe current time point of the model (read-only)
Nthe total number of animals alive (read-only)
statea data frame representing the current state of the model (read-only)
trans_externalthe external transmission parameter
transmission_typeeither frequency or density
new()
Create a new within-group model
KoalasV1$new(
update_type = c("deterministic", "stochastic"),
group_name = NA_character_
)update_typeone of deterministic or stochastic
group_namean optional name for the group (will be included in the output state, if provided)
A new within-group model object
update()
Update the state of the group for a single time point
KoalasV1$update(d_time)
d_timethe desired time step (delta time)
self, invisibly
run()
Update the state of the group for several time points
KoalasV1$run(add_time, d_time, thin = 1)
add_timethe additional time to add to the current time of the model
d_timethe desired time step (delta time)
thinthinning parameter (currently ignored)
a data frame of the model state at each (new) time point
vaccinate()
Implement a (one-time) vaccination effort at the current time point
KoalasV1$vaccinate(number, proportion, efficacy)
numberthe (maximum) number of animals to vaccinate (ignored if proportion is supplied)
proportionthe proportion of animals to vaccinate
efficacythe efficacy of the vaccine i.e. probability of the animal moving to V (from S, I or D - R and V do not move)
active_test()
Implement a (one-time) active sampling/capture/testing of all animals
KoalasV1$active_test(number, proportion, sensitivity, specificity)
numberthe (maximum) number of animals to test and remove (ignored if proportion is supplied)
proportionthe proportion of animals to test and remove
sensitivitythe sensitivity of the test
specificitythe specificity of the test
passive_test()
Implement a (one-time) passive sampling/capture/testing of diseased animals
KoalasV1$passive_test( number, proportion, sensitivity, specificity, prevalence_other )
numberthe (maximum) number of animals to test and remove (ignored if proportion is supplied)
proportionthe proportion of animals to test and remove
sensitivitythe sensitivity of the test
specificitythe specificity of the test
prevalence_otherthe prevalence of other conditions that resemble clinical disease
print()
Print method giving an overview of the current state and parameter values
KoalasV1$print()
self, invisibly
clone()
The objects of this class are cloneable with this method.
KoalasV1$clone(deep = FALSE)
deepWhether to make a deep clone.
This is the "V2" model that has substantial differences to the Grogan et al model (KoalasV1)
datethe current date of the model (read-only)
daythe current day number of the model (read-only)
Nthe total number of animals alive (read-only)
prevalencethe current prevalence (read-only)
statea list representing the current state of the model
parametersa list of parameter values
results_widea data frame of results from the model in wide format (read-only)
results_longa data frame of results from the model in long format, with aggregated/summarised compartments (read-only)
interventionsa data frame of intervention time points from the model (read-only)
run_datesa date vector of dates when run was called, which might be useful for e.g. adding dashed lines to plots (read-only)
treatmentsa data frame of cumulative treatments and vaccinations from the model (read-only)
new()
Create a new single-group koala model
KoalasV2$new( num = 3L, num_V = num, num_I = num, num_N = num, num_R = num, num_A = num, parameters = list(), state = list(), start_date = "2021-01-01" )
numnumber of sub-components for all states (unless overridden) - currently must be either 1 or 3
num_Vnumber of sub-components for V (and Vf)
num_Inumber of sub-components for I (and If)
num_Nnumber of sub-components for N (and Nf)
num_Rnumber of sub-components for R (and Rf)
num_Anumber of sub-components for Af
parametersa list of parameter values - see the set_parameters method for the allowed values
statean initialisation state list - see the set_state method for the allowed values
start_datethe date corresponding to day 0 of the simulation (only used for outputs)
A new within-group model object
set_parameters()
Change one or more current parameter values
KoalasV2$set_parameters( vacc_immune_duration, vacc_redshed_duration, natural_immune_duration, beta, subcinical_duration, subclinical_recover_proportion, diseased_recover_proportion, birthrate, acute_duration, lifespan_natural, lifespan_acute, lifespan_chronic, relative_fecundity, sensitivity, specificity, cure_prob_N, cure_prob_I, cure_prob_A, cure_prob_C, vaccine_efficacy, vaccine_booster, passive_intervention_rate )
vacc_immune_duration#1: Average duration of vaccine-related immunity from infection for susceptibles
vacc_redshed_duration#2: Average duration of treatment/vaccine-related reduction in shedding for infecteds, relative to #1
natural_immune_duration#3: Average duration of natural immunity following resolved infection , relative to #1
beta#4: Infection rate (frequency dependent)
subcinical_duration#5: Average duration of subclinical infection before progression to “acute” disease OR spontaneous recovery
subclinical_recover_proportion#6: Proportion of animals that will spontaneously recover, rather than progressing to acute disease
diseased_recover_proportion#7: Spontaneous recovery rate for diseased animals – ASSUMED DOES NOT HAPPEN SO MUST BE ZERO
birthrate#8: Birth rate (assumed not density-dependent, for now)
acute_duration#9: Average duration of acute (increased mortality) phase before progressing to chronic (normal mortality) phase
lifespan_natural#10: Average lifespan of uninfected koalas (assumed not density-dependent, for now)
lifespan_acute#11: Disease-related mortality rate (replacement for #10) - default is calibrated so that 25% die before entering Cf
lifespan_chronic#11: Disease-related mortality rate (replacement for #10)
relative_fecundity#12: Relative fecundity of diseased animals - NOTE: we ignore males as only females are important for reproduction
sensitivitysensitivity of lab test to detect shedding in I(f), Af, Cf
specificityspecificity of lab test to not detect shedding in other compartments
cure_prob_Nproportion of N(f) animals with a completed treatment course that are cured of infection (go to R(f))
cure_prob_Iproportion of I(f) animals with a completed treatment course that are cured of infection (go to R(f))
cure_prob_Aproportion of Af animals with a completed treatment course that are cured of infection (go to Rf)
cure_prob_Cproportion of Cf animals with a completed treatment course that are cured of infection (go to Rf)
vaccine_efficacyproportion of S(f) animals that have effective vaccination i.e. go to V(f)
vaccine_boosterproportion of already-vaccinated/immune animals that re-start their time in that category due to the “booster effect” i.e. V(f), N(f), and R(f)
passive_intervention_raterate at which animals are brought in for test/treatment/vaccination passively (can be interpreted as the expected number of times per year each animal is brought in)
self, invisibly
set_state()
Change one or more current state values
KoalasV2$set_state( S, V, I, N, R, Af, Cf, Sf, Vf, If, Nf, Rf, Day, SumTx, SumVx, SumRx, SumMx )
Snumber of S
Vnumber of V
Inumber of I
Nnumber of N
Rnumber of R
Afnumber of Af
Cfnumber of Cf
Sfnumber of Sf
Vfnumber of Vf
Ifnumber of If
Nfnumber of Nf
Rfnumber of Rf
Daycurrent day of the simulation (you probably shouldn't change this)
SumTxcumulative total number of animals with a successful treatment course (you probably shouldn't change this)
SumVxcumulative total number of animals vaccinated - this excludes the animals also treated (you probably shouldn't change this)
SumRxcumulative total number of animals removed due to voluntary culling and failure to cure (you probably shouldn't change this)
SumMxcumulative mortality due to disease excluding SumRx (you probably shouldn't change this)
self, invisibly
update()
Update the model for one or more day
KoalasV2$update(n_days = 1L, d_time = 1/24, record = TRUE)
n_daysthe number of days to update for
d_timethe desired time step (delta time)
recordshould the state over time be recorded?
self, invisibly
active_intervention()
Implement a (one-time) active sampling/capture/testing of all animals
KoalasV2$active_intervention( proportion, cull_positive = 0, cull_acute = 0.2, cull_chronic = 0.3 )
proportionthe proportion of animals to test/treat/vaccinate
cull_positivethe proportion of test-positive animals that will be culled
cull_acutethe proportion of acute diseased animals that will be culled
cull_chronicthe proportion of chronic diseased animals that will be culled
targeted_intervention()
Implement a (one-time) targeted capture/treatment of diseased animals
KoalasV2$targeted_intervention( proportion, prop_acute = proportion, prop_chronic = proportion, cull_positive = 0, cull_acute = 0.2, cull_chronic = 0.3 )
proportionthe proportion of diseased animals to identify and treat (overridden by prop_acute and/or prop_chronic, if set)
prop_acutethe proportion of acutely diseased animals to identify and treat (overrides proportion)
prop_chronicthe proportion of chronic diseased animals to identify and treat (overrides proportion)
cull_positivethis parameter is ignored (it is only provided for compatibility with the run method)
cull_acutethe proportion of acute diseased animals that will be culled
cull_chronicthe proportion of chronic diseased animals that will be culled
burnin()
Set and burn-in the model for standard scenarios (with current parameters)
KoalasV2$burnin(scenario = c("worst", "best", "combined"), d_time = 1/24)scenariothe desired population scenario for calibration (worst case, best case, or combined)
d_timethe desired time step (delta time)
self, invisibly
run()
Run the model for 1 or more years with the standard scenarios
KoalasV2$run( years, frequency, prop_active = 0, prop_targeted = 0, d_time = 1/24, ... )
yearsthe number of years to run for
frequencythe number of sampling events per year
prop_activethe proportion of animals to test/treat/vaccinate with active sampling at each intervention
prop_targetedthe proportion of diseased animals to treat with targeted interventions at each intervention
d_timethe desired time step (delta time)
...additional arguments (cull proportions) passed to the active_intervention method
self, invisibly
print()
Print method giving an overview of the current state and parameter values
KoalasV2$print()
self, invisibly
autoplot()
autoplot method for a default plot
KoalasV2$autoplot(
show_treatments = TRUE,
prev_line = 5,
number_line = NULL,
ymax = c(Treatment = NA_real_, Number = NA_real_, Prevalence = 100),
alphas = c(Treatment = 0.25, Number = 0.5, Prevalence = 0.25),
colours = c(Diseased = "#F8766D", Infectious = "#F9C945", Healthy = "#619CFF",
Treatment = "forestgreen", Prevalence = "black"),
dot_col = "grey50"
)show_treatmentsoption to show/hide treatments
prev_linean optional dotted line for target prevalence
number_linean optional dotted line for a target stable (or starting) population size - NULL means to use the starting population size
ymaxa named numeric vector of maximum values for the y axis
alphasa named numeric vector of alpha values for each subplot
coloursa named numeric vector of colour values for each subplot/compartment
dot_colthe colour to use for the dotted prevalence and number lines
a ggplot2 object
clone()
The objects of this class are cloneable with this method.
KoalasV2$clone(deep = FALSE)
deepWhether to make a deep clone.