sir: Euler scheme for the SIR model

Description Usage Arguments Value Examples

View source: R/sir.R

Description

A basic Euler scheme is used to numerically solve the ODE system of the standard SIR model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sir(
  beta,
  gamma,
  s0 = 1,
  i0 = 1e-04,
  r0 = 0,
  t0 = 0,
  tn = 1,
  n = 1000,
  verbose = TRUE
)

Arguments

beta

the mean rate of contact, 1/beta the mean time between contact for a given individual (homogeneous population and mixing)

gamma

the mean rate of recovery, 1/gamma the mean time until recovery.

s0

the initial susceptible population

i0

the initial infected population

r0

the initial recovering population, defaults to zer0

t0

initial time point

tn

the terminal time point

n

number of sub-intervals in time-grid

verbose

whether to plot the populations over time and print parameter+reproductive ratio

Value

list

Examples

1
{sir.dat <- sir(beta = 1/2, gamma = 1/3, s0 = 50, i0 = 1, tn = 90, n = 1000)}

shill1729/odeSolveR documentation built on March 31, 2021, 10:52 a.m.