SIR {SimInf} | R Documentation

## Create an SIR model

### Description

Create an SIR model to be used by the simulation framework.

### Usage

    SIR(u0, tspan, events = NULL, beta = NULL, gamma = NULL)

### Arguments

`u0` | A `data.frame` with the initial state in each node (see ‘Details’).
`tspan` | A vector (length >= 2) of increasing time points where the state of each node is to be returned. Can be either an `integer` or a `Date` vector. A `Date` vector is coerced to a numeric vector as days, where `tspan[1]` becomes the day of the year of the first year of `tspan`. The dates are added as names to the numeric vector.
`events` | a `data.frame` with the scheduled events, see `SimInf_model`.
`beta` | The transmission rate from susceptible to infected.
`gamma` | The recovery rate from infected to recovered.

### Details

The SIR model contains three compartments; number of susceptible (S), number of infectious (I), and number of recovered (R). Moreover, it has two state transitions,

S -- beta S I / N --> I

I -- gamma I --> R

where β is the transmission rate, γ is the recovery rate, and N=S+I+R.

The argument `u0` must be a `data.frame` with one row for each node with the following columns:

S

  The number of sucsceptible in each node

I

  The number of infected in each node

R

  The number of recovered in each node

### Value

A `SimInf_model` of class `SIR`

### Examples

    ## Create an SIR model object.
    model <- SIR(u0 = data.frame(S = 99, I = 1, R = 0),
                 tspan = 1:100,
                 beta = 0.16,
                 gamma = 0.077)

    ## Run the SIR model and plot the result.
    set.seed(22)
    result <- run(model)
    plot(result)

[Package SimInf version 6.3.0 Index]