View source: R/CalculateFromData.R
simulate_from_data | R Documentation |
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
)
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: |
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 |
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)
simulate_from_data(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.