A basic SIR model with 3 compartments, infection and recovery and birth and death processes
simulate_sirdemographic_ode( S = 1000, I = 1, R = 0, b = 0.002, g = 1, m = 0, n = 0, tstart = 0, tfinal = 100, dt = 0.1 )
: starting value for Susceptible : numeric
: starting value for Infected : numeric
: starting value for Recovered : numeric
: infection rate : numeric
: recovery rate : numeric
: the rate at which new individuals enter the model (are born) : numeric
: the rate of natural death (the inverse is the average lifespan) : 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 dataframe has one column per compartment/variable. The first column is time.
The model includes susceptible, infected, and recovered compartments. The two infection related processes that are modeled are infection and recovery. Natural births and deaths are also included.
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.
# To run the simulation with default parameters: result <- simulate_sirdemographic_ode()