u0_SIR: Example data to initialize the 'SIR' model

View source: R/SIR.R

u0_SIRR Documentation

Example data to initialize the ‘SIR’ model

Description

Example data to initialize a population of 1600 nodes and demonstrate the SIR model.

Usage

u0_SIR()

Details

A data.frame with the number of individuals in the ‘S’, ‘I’ and ‘R’ compartments in 1600 nodes. Note that the ‘I’ and ‘R’ compartments are zero.

Value

A data.frame

Examples

## Create an 'SIR' model with 1600 nodes and initialize
## it to run over 4*365 days. Add one infected individual
## to the first node.
u0 <- u0_SIR()
u0$I[1] <- 1
tspan <- seq(from = 1, to = 4*365, by = 1)
model <- SIR(u0     = u0,
             tspan  = tspan,
             events = events_SIR(),
             beta   = 0.16,
             gamma  = 0.01)

## Run the model to generate a single stochastic trajectory.
result <- run(model)
plot(result)

## Summarize trajectory
summary(result)

SimInf documentation built on Jan. 23, 2023, 5:43 p.m.