simulate_from_data_delay.Rd
Uses the compartmental model to simulate a trajectory, starting from equilibrium variable
simulate_from_data_delay(
df,
from_equilibrium = TRUE,
initial_states = NULL,
f = 1/72,
gamma = 1/223,
r = 1/60,
maxtime,
year,
rcd = FALSE,
referral = FALSE,
mda = FALSE,
rcd_at_baseline = FALSE,
sto = FALSE,
sto_method = "exact",
runs = 1,
seeds = NULL
)
a dataframe containing the data, with one column called I containing the proportion
of infectious individuals (U0+Ul+Tl+T0) 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)
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
given initial condition, as a dataframe containing the variables "Ul_init", "U0_init", "Sl_init", "S0_init", "Tl_init", "T0_init", "h_init", with one variable called id which identifies uniquely each row in the dataset. This input is not used when from_equilibrium=TRUE (default).
relapse frequency
liver clearance rate
blood clearance rate
number of time steps for simulation
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).
a boolean indicating if the model including reactive case detection should be used. Default (FALSE) is the model without RCD
a boolean indicating if the rcd model includes referral. Default (FALSE) is the model without referral for RCD. This parameter is used only if rcd==TRUE.
a boolean indicating if the model including mass drug administration (MDA) prophylaxis should be used. Default (FALSE) is the model without MDA
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
a boolean indicating if the stochastic model is used. Default (FALSE) is the deterministic (ODE) model
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.
number of draws of the stochastic model
a vector of the length of runs containing the seeds for each simulation (don't use "0" which has another use in TiPS)
A dataframe with the simulated state variables for each parameter combination in df
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.
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)
mydata$sigma.old=c(1/15,1/15)
simulate_from_data_delay(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 sigma.new in df, assumed sigma.new=sigma.old
#> Warning: no delta.new in df, assumed delta.new=delta
#> simulating from equilibrium
#> time Ul U0 Sl S0 Tl
#> 1 0 0.01413136 0.002199656 0.01574498 0.9672550 0.0006486833
#> 366 365 0.01517715 0.002336358 0.01674399 0.9650189 0.0007016901
#> 731 730 0.01618340 0.002491215 0.01785302 0.9627011 0.0007479504
#> 1096 1095 0.01720971 0.002649158 0.01898402 0.9603372 0.0007950997
#> 1461 1460 0.01825078 0.002809368 0.02013114 0.9579395 0.0008428926
#> 1826 1825 0.01930100 0.002970979 0.02128819 0.9555209 0.0008910697
#> 11 0 0.10166248 0.015151683 0.10388639 0.7761136 0.0030900057
#> 3661 365 0.10927951 0.016086106 0.11039108 0.7607984 0.0033415708
#> 7311 730 0.11472097 0.016885970 0.11585671 0.7489276 0.0035004758
#> 10961 1095 0.11875547 0.017478972 0.11990714 0.7401287 0.0036178250
#> 14611 1460 0.12167489 0.017908041 0.12283701 0.7337630 0.0037024904
#> 18261 1825 0.12375040 0.018213064 0.12491941 0.7292382 0.0037625541
#> T0 h hl hh hhl I p
#> 1 2.029819e-05 0.1217156 0.1217156 0.1217156 0.1217156 0.01700000 0
#> 366 2.190792e-05 0.1255849 0.1255849 0.1255849 0.1255849 0.01823711 0
#> 731 2.335217e-05 0.1340001 0.1340001 0.1340001 0.1340001 0.01944592 0
#> 1096 2.482416e-05 0.1426265 0.1426265 0.1426265 0.1426265 0.02067879 0
#> 1461 2.631624e-05 0.1513931 0.1513931 0.1513931 0.1513931 0.02192936 0
#> 1826 2.782030e-05 0.1602531 0.1602531 0.1602531 0.1602531 0.02319087 0
#> 11 9.583498e-05 0.8232064 0.8232064 0.8232064 0.8232064 0.12000000 0
#> 3661 1.033767e-04 0.8491111 0.8491111 0.8491111 0.8491111 0.12881057 0
#> 7311 1.082891e-04 0.8963257 0.8963257 0.8963257 0.8963257 0.13521570 0
#> 10961 1.119164e-04 0.9318693 0.9318693 0.9318693 0.9318693 0.13996419 0
#> 14611 1.145333e-04 0.9577936 0.9577936 0.9577936 0.9577936 0.14339995 0
#> 18261 1.163897e-04 0.9763302 0.9763302 0.9763302 0.9763302 0.14584241 0
#> incidence id
#> 1 121.7156 1
#> 366 125.5849 1
#> 731 134.0001 1
#> 1096 142.6265 1
#> 1461 151.3931 1
#> 1826 160.2531 1
#> 11 823.2064 2
#> 3661 849.1111 2
#> 7311 896.3257 2
#> 10961 931.8693 2
#> 14611 957.7936 2
#> 18261 976.3302 2