View source: R/CalculateFromDataDelay.R
simulate_from_data_delay | R Documentation |
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
)
df |
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: |
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 "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). |
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 |
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 without 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) |
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.
A dataframe with the simulated state variables for each parameter combination in df
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.