Uses the compartmental model to simulate a trajectory, starting from equilibrium equilibrium state or a given initial condition

simulate_from_data(
  df,
  from_equilibrium = TRUE,
  initial_states = NULL,
  f = 1/72,
  gamma = 1/223,
  r = 1/60,
  maxtime,
  year,
  rcd = FALSE,
  mda = FALSE,
  rcd_at_baseline = FALSE
)

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)

from_equilibrium

boolean indicating if the model is run from equilibrium (TRUE, default) or from a pre-specified initial condition, which should be specified in initial_states

initial_states

given initial condition, as a dataframe containing the variables "Il_init", "I0_init", "Sl_init", "S0_init", "h_init", "hr_init", with one variable called id which identifies uniquely each row in the dataset. This input is not used when from_equilibrium=TRUE (default).

f

relapse frequency

gamma

liver clearance rate

r

blood clearance rate

maxtime

number of time steps for simulation

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).

rcd

if TRUE, includes RCD in the model. Default is FALSE (no RCD)

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

Value

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

Details

If alpha is not provided in df, alpha=0. If beta is not provided in df, beta=1. If rho is not provided in df, rho=1. If omega is not provided in df, omega=1. If delta is not provided in df, delta=0.

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=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)
simulate_from_data(df=mydata, f=1/69, gamma=1/383, r=1/60,maxtime=2000,year=TRUE)
#> Warning: no rho.old in df, assumed rho.old=1
#> Warning: no rho.new in df, assumed rho.new=rho.old
#> Warning: no omega.new in df, assumed omega.new=omega.old
#> Warning: no alpha.new in df, assumed alpha.new=alpha.old
#> Warning: no beta.new in df, assumed beta.new=beta.old
#> Warning: no delta.new in df, assumed delta.new=delta
#> simulating from equilibrium
#>       time         Il          I0         Sl        S0         h         hr
#> 1        0 0.01471024 0.002289762 0.01615618 0.9668438 0.1238908 0.08546385
#> 366    365 0.01438409 0.002246759 0.01585660 0.9675126 0.1227247 0.08473095
#> 731    730 0.01409992 0.002202387 0.01554367 0.9681540 0.1202818 0.08304378
#> 1096  1095 0.01383094 0.002160387 0.01524746 0.9687612 0.1179602 0.08143324
#> 1461  1460 0.01357599 0.002120579 0.01496669 0.9693367 0.1157607 0.07990768
#> 1826  1825 0.01333404 0.002082798 0.01470021 0.9698829 0.1136742 0.07846073
#> 11       0 0.10443509 0.015564910 0.10578660 0.7742134 0.8332582 0.55959581
#> 3661   365 0.10611428 0.015772160 0.10717853 0.7709350 0.8388155 0.56312623
#> 7311   730 0.10727106 0.015943739 0.10833935 0.7684458 0.8489117 0.57017942
#> 10961 1095 0.10813078 0.016071248 0.10920197 0.7665960 0.8564733 0.57549484
#> 14611 1460 0.10876653 0.016165537 0.10983981 0.7652281 0.8620741 0.57943496
#> 18261 1825 0.10923493 0.016235005 0.11030972 0.7642203 0.8662056 0.58234305
#>              hl        hh       hhl          I p incidence id
#> 1     0.1238908 0.1238908 0.1238908 0.01700000 0  123.8908  1
#> 366   0.1227247 0.1227247 0.1227247 0.01663085 0  122.7247  1
#> 731   0.1202818 0.1202818 0.1202818 0.01630231 0  120.2818  1
#> 1096  0.1179602 0.1179602 0.1179602 0.01599133 0  117.9602  1
#> 1461  0.1157607 0.1157607 0.1157607 0.01569657 0  115.7607  1
#> 1826  0.1136742 0.1136742 0.1136742 0.01541684 0  113.6742  1
#> 11    0.8332582 0.8332582 0.8332582 0.12000000 0  833.2582  2
#> 3661  0.8388155 0.8388155 0.8388155 0.12188644 0  838.8155  2
#> 7311  0.8489117 0.8489117 0.8489117 0.12321480 0  848.9117  2
#> 10961 0.8564733 0.8564733 0.8564733 0.12420202 0  856.4733  2
#> 14611 0.8620741 0.8620741 0.8620741 0.12493207 0  862.0741  2
#> 18261 0.8662056 0.8662056 0.8662056 0.12546994 0  866.2056  2