simulate_SIRSd_model_stochastic {DSAIDE} | R Documentation |
SIRSd model
Description
A SIRSd model with 3 compartments. Processes are infection, recovery, births deaths and waning immunity.
Usage
simulate_SIRSd_model_stochastic(
S = 1000,
I = 1,
R = 0,
b = 0.002,
g = 1,
w = 1,
n = 0,
m = 0,
tfinal = 100,
rngseed = 123
)
Arguments
S |
: starting value for Susceptible : numeric |
I |
: starting value for Infected : numeric |
R |
: starting value for Recovered : numeric |
b |
: infection rate : numeric |
g |
: recovery rate : numeric |
w |
: waning immunity rate : numeric |
n |
: birth rate : numeric |
m |
: death rate : numeric |
tfinal |
: Final time of simulation : numeric |
rngseed |
: set random number seed for reproducibility : numeric |
Details
The model includes susceptible, infected, and recovered compartments. The processes which are modeled are infection, recovery, natural births and deaths and waning immunity.
This code was generated by the modelbuilder R package. The model is implemented as a set of stochastic equations using the adaptivetau package. The following R packages need to be loaded for the function to work: adpativetau
Value
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.
Warning
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.
Model Author
Andreas Handel
Model creation date
2020-09-01
Code Author
generated by the modelbuilder
R package
Code creation date
2021-07-19
Examples
# To run the simulation with default parameters:
result <- simulate_SIRSd_model_stochastic()
# To choose values other than the standard one, specify them like this:
result <- simulate_SIRSd_model_stochastic(S = 2000,I = 2,R = 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'])))