Uses the compartmental model to simulate the effect of interventions

simulate_vivax_interventions(
  df,
  intervention_list,
  previous_simulation = NULL,
  f = 1/72,
  gamma = 1/223,
  r = 1/60,
  year = T,
  maxtime = 2000,
  delay = FALSE,
  rcd = FALSE,
  referral = FALSE,
  mda = FALSE,
  rcd_at_baseline = FALSE,
  sto = FALSE,
  sto_method = "exact",
  runs = 1,
  seeds = NULL
)

Arguments

df

a dataframe containing the data, with one column called I containing the proportion of infectious individuals (I0+Il) at equilibrium, one column called lambda containing the transmission rate, and one variable called id which identifies uniquely each row in the dataset. Additional optional variables are:
rho (reporting rate), delta (importation rate)
intervention levels in the past (when lambda was calculated): alpha.old (effective care), beta.old (proportion of liver stage cure), omega.old (intensity of vector control) intervention levels in the future (in the simulation): alpha.new (effective care), beta.new (proportion of liver stage cure), omega.new (intensity of vector control) In practice, this dataframe can be the output of the function calculate_r0_rc_fromdata

intervention_list

a list of intervention objects.

previous_simulation

the result of a previous simulation (e.g. the outcome of simulate_vivax_interventions or chain_vivax_interventions). If NULL (default), the model is simulated from equilibrium

f

relapse frequency

gamma

liver clearance rate

r

blood clearance rate

year

if TRUE, aggregates the outputs per year (h would be in cases per person year). if FALSE, returns daily outputs (h would be in cases per person day).

maxtime

number of time steps for simulation

delay

a boolean indicating if the model including delays in treatment should be used. Default (FALSE) is the model without delay in treatment

rcd

a boolean indicating if the model including reactive case detection should be used. Default (FALSE) is the model without RCD

referral

a boolean indicating if the rcd model includes referral. Default (FALSE) is the model with referral for RCD. This parameter is used only if rcd==TRUE.

mda

a boolean indicating if the model including mass drug administration (MDA) prophylaxis should be used. Default (FALSE) is the model without MDA

rcd_at_baseline

a boolean indicating if the model was calibrated using the RCD model (i.e. there is some RCD at baseline already). Default (FALSE) is the model without RCD at baseline

sto

a boolean indicating if the stochastic model is used. Default (FALSE) is the deterministic (ODE) model

sto_method

a scalarindicating which simulation method is used. Default ("exact") is Gillespie's direct method. Other options are "approximate" (tau-leap) or "mixed". cf. the documentation of the TiPS package for more information.

runs

number of draws of the stochastic model

seeds

a vector of the length of runs containing the seeds for each simulation (don't use "0" which has another use in TiPS)

Value

A dataframe with the simulated state variables for each parameter combination in df

Details

An intervention object is named list containing the intervention description. It should have the follwing structure: list(intervention_name="string", "alpha.new"=NA, "beta.new"=NA, "omega.new"=NA, "rho.new"=NA ) where NA can be replaced by scalars or kepts as such. If alpha.new is not provided in intervention_object it is equal to alpha. If beta.new is not provided in intervention_object it is equal to beta. If omega.new is not provided in intervention_object it is equal to omega. If rho.new is not provided in intervention_object it is equal to rho.

Examples

mydata=data.frame(incidence=c(23,112),lambda=c(0.0063,0.0071),I=c(0.017,0.12),id=c(1,2))
mydata$rho.old=c(0.18,0.13)
mydata$beta.old=c(0.43,0.42)
mydata$alpha.old=c(0.17, 0.12)
mydata$delta=c(0,0)
mydata$omega.old=c(1,1)
int_0=list(intervention_name="0", "alpha.new"=NA, "beta.new"=NA, "omega.new"=NA, "rho.new"=NA )
int_A=list(intervention_name="A", "alpha.new"=NA, "beta.new"=0.6, "omega.new"=NA, "rho.new"=NA )
my_intervention_list=list(int_0, int_A)
simulate_vivax_interventions(df=mydata, my_intervention_list)
#> Warning: no rho in df, assumed rho=0
#> Warning: no alpha in df, assumed alpha=0
#> Warning: no beta in df, assumed beta=1
#> Warning: no omega in df, assumed omega=1
#> Warning: no rho in df, assumed rho=0
#> Warning: no alpha in df, assumed alpha=0
#> Warning: no beta in df, assumed beta=1
#> Warning: no omega in df, assumed omega=1
#> Starting from equilibrium
#> simulating from equilibrium
#>    id time          Il          I0          Sl        S0          h         hr
#> 1   1    0 0.013413918 0.003586082 0.012097497 0.9709025 0.09975453 0.06132759
#> 2   1  365 0.011438304 0.003135727 0.010553559 0.9748724 0.09317187 0.05760483
#> 3   1  730 0.009903445 0.002714985 0.009137410 0.9782442 0.08058115 0.04980629
#> 4   1 1095 0.008610033 0.002360402 0.007944044 0.9810855 0.06996198 0.04321257
#> 5   1 1460 0.007511743 0.002059311 0.006930707 0.9834982 0.06096749 0.03763487
#> 6   1 1825 0.006573085 0.001801982 0.006064655 0.9855603 0.05329674 0.03288328
#> 7   1    0 0.013413918 0.003586082 0.012097497 0.9709025 0.09975453 0.06132759
#> 8   1  365 0.011438304 0.003135727 0.010553559 0.9748724 0.09317187 0.05760483
#> 9   1  730 0.009903445 0.002714985 0.009137410 0.9782442 0.08058115 0.04980629
#> 10  1 1095 0.008610033 0.002360402 0.007944044 0.9810855 0.06996198 0.04321257
#> 11  1 1460 0.007511743 0.002059311 0.006930707 0.9834982 0.06096749 0.03763487
#> 12  1 1825 0.006573085 0.001801982 0.006064655 0.9855603 0.05329674 0.03288328
#> 13  2    0 0.095543458 0.024456542 0.082828344 0.7971717 0.69355609 0.41989369
#> 14  2  365 0.078146883 0.020707633 0.069914061 0.8312314 0.63758658 0.38744504
#> 15  2  730 0.067640207 0.017923740 0.060514192 0.8539219 0.54507721 0.32908326
#> 16  2 1095 0.060261253 0.015968417 0.053912623 0.8698577 0.48125390 0.28913605
#> 17  2 1460 0.054815060 0.014525250 0.049040196 0.8816195 0.43489860 0.26037486
#> 18  2 1825 0.050646308 0.013420587 0.045310630 0.8906225 0.39983443 0.23875684
#> 19  2    0 0.095543458 0.024456542 0.082828344 0.7971717 0.69355609 0.41989369
#> 20  2  365 0.078146883 0.020707633 0.069914061 0.8312314 0.63758658 0.38744504
#> 21  2  730 0.067640207 0.017923740 0.060514192 0.8539219 0.54507721 0.32908326
#> 22  2 1095 0.060261253 0.015968417 0.053912623 0.8698577 0.48125390 0.28913605
#> 23  2 1460 0.054815060 0.014525250 0.049040196 0.8816195 0.43489860 0.26037486
#> 24  2 1825 0.050646308 0.013420587 0.045310630 0.8906225 0.39983443 0.23875684
#>            hl         hh        hhl           I p incidence intervention step
#> 1  0.09975453 0.09975453 0.09975453 0.017000000 0  99.75453            0    1
#> 2  0.09317187 0.09317187 0.09317187 0.014574032 0  93.17187            0    1
#> 3  0.08058115 0.08058115 0.08058115 0.012618430 0  80.58115            0    1
#> 4  0.06996198 0.06996198 0.06996198 0.010970435 0  69.96198            0    1
#> 5  0.06096749 0.06096749 0.06096749 0.009571054 0  60.96749            0    1
#> 6  0.05329674 0.05329674 0.05329674 0.008375067 0  53.29674            0    1
#> 7  0.09975453 0.09975453 0.09975453 0.017000000 0  99.75453            A    1
#> 8  0.09317187 0.09317187 0.09317187 0.014574032 0  93.17187            A    1
#> 9  0.08058115 0.08058115 0.08058115 0.012618430 0  80.58115            A    1
#> 10 0.06996198 0.06996198 0.06996198 0.010970435 0  69.96198            A    1
#> 11 0.06096749 0.06096749 0.06096749 0.009571054 0  60.96749            A    1
#> 12 0.05329674 0.05329674 0.05329674 0.008375067 0  53.29674            A    1
#> 13 0.69355609 0.69355609 0.69355609 0.120000000 0 693.55609            0    1
#> 14 0.63758658 0.63758658 0.63758658 0.098854516 0 637.58658            0    1
#> 15 0.54507721 0.54507721 0.54507721 0.085563947 0 545.07721            0    1
#> 16 0.48125390 0.48125390 0.48125390 0.076229671 0 481.25390            0    1
#> 17 0.43489860 0.43489860 0.43489860 0.069340309 0 434.89860            0    1
#> 18 0.39983443 0.39983443 0.39983443 0.064066895 0 399.83443            0    1
#> 19 0.69355609 0.69355609 0.69355609 0.120000000 0 693.55609            A    1
#> 20 0.63758658 0.63758658 0.63758658 0.098854516 0 637.58658            A    1
#> 21 0.54507721 0.54507721 0.54507721 0.085563947 0 545.07721            A    1
#> 22 0.48125390 0.48125390 0.48125390 0.076229671 0 481.25390            A    1
#> 23 0.43489860 0.43489860 0.43489860 0.069340309 0 434.89860            A    1
#> 24 0.39983443 0.39983443 0.39983443 0.064066895 0 399.83443            A    1