R/simulate_Environmental_Transmission_model_ode.R
simulate_Environmental_Transmission_model_ode.Rd
An SIR model including environmental transmission
simulate_Environmental_Transmission_model_ode(
S = 1000,
I = 1,
R = 0,
P = 0,
bI = 0.004,
bP = 0,
n = 0,
m = 0,
g = 2,
q = 0,
c = 0,
tstart = 0,
tfinal = 60,
dt = 0.1
)
: starting value for Susceptible : numeric
: starting value for Infected : numeric
: starting value for Recovered : numeric
: starting value for Pathogen in environment : numeric
: direct transmission rate : numeric
: environmental transmission rate : numeric
: birth rate : numeric
: natural death rate : numeric
: recovery rate : numeric
: rate at which infected hosts shed pathogen into the environment : numeric
: rate at which pathogen in the environment decays : numeric
: Start time of simulation : numeric
: Final time of simulation : numeric
: Time step : numeric
The function returns the output as a list.
The time-series from the simulation is returned as a dataframe saved as list element ts
.
The ts
dataframe has one column per compartment/variable. The first column is time.
The model includes susceptible, infected, recovered and environmental pathogen compartments. Infection can occur through direct contact with infected or through contact with pathogen in the environment. Infected individuals shed into the environment, pathogen decays there.
This code was generated by the modelbuilder R package. The model is implemented as a set of ordinary differential equations using the deSolve package. The following R packages need to be loaded for the function to work: deSolve.
This function does not perform any error checking. So if you try to do something nonsensical (e.g. have negative values for parameters), the code will likely abort with an error message.
2020-12-01
2021-07-19
# To run the simulation with default parameters:
result <- simulate_Environmental_Transmission_model_ode()
# To choose values other than the standard one, specify them like this:
result <- simulate_Environmental_Transmission_model_ode(S = 2000,I = 2,R = 0,P = 0)
# You can display or further process the result, like this:
plot(result$ts[,'time'],result$ts[,'S'],xlab='Time',ylab='Numbers',type='l')
print(paste('Max number of S: ',max(result$ts[,'S'])))
#> [1] "Max number of S: 2000"