Learn R Programming

SimInf (version 11.1.0)

u0_SEIR: Example initial population data for the SEIR model

Description

Synthetic dataset containing the initial number of susceptible, exposed, infected, and recovered cattle (individuals) across 1,600 cattle herds (nodes). Provides a heterogeneous population structure for demonstrating SEIR model simulations in a compartmental modeling context.

Usage

u0_SEIR()

Arguments

Value

A data.frame with 1,600 rows (one per node) and 4 columns:

S

Number of susceptible cattle (individuals) in the herd (node)

E

Number of exposed cattle (individuals) in the herd (node) (all zero at start)

I

Number of infected cattle (individuals) in the herd (node) (all zero at start)

R

Number of recovered cattle (individuals) in the herd (node) (all zero at start)

Details

This dataset represents initial disease states in a population of 1,600 cattle herds (nodes). Each row represents a single herd (node), derived from a synthetic population structure by adding an exposed compartment to the SIR model framework.

The data contains:

S

Total susceptible cattle (individuals) in the node

E

Total exposed cattle (individuals) (initialized to zero)

I

Total infected cattle (individuals) (initialized to zero)

R

Total recovered cattle (individuals) (initialized to zero)

The herd size distribution is synthetically generated to reflect heterogeneity typical of large-scale populations, making it suitable for illustrating how to incorporate scheduled events in the SimInf framework.

See Also

SEIR for creating SEIR models with this initial state and events_SEIR for associated movement and demographic events

Examples

Run this code
## For reproducibility, call the set.seed() function and specify the
## number of threads to use. To use all available threads, remove the
## set_num_threads() call.
set.seed(123)
set_num_threads(1)

## Create a 'SEIR' model with 1600 cattle herds (nodes) and initialize
## it to run over 4*365 days. Add ten exposed animals to the first
## herd. Define 'tspan' to record the state of the system at weekly
## time-points. Load scheduled events for the population of nodes with
## births, deaths and between-node movements of individuals.
u0 <- u0_SEIR()
u0$E[1] <- 10
model <- SEIR(
    u0      = u0,
    tspan   = seq(from = 1, to = 4*365, by = 7),
    events  = events_SEIR(),
    beta    = 0.16,
    epsilon = 0.25,
    gamma   = 0.01
)

## Display the number of cattle affected by each event type per day.
plot(events(model))

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

## Plot the median and interquartile range of the number of
## susceptible, exposed, infected and recovered individuals.
plot(result)

## Plot the trajectory for the first herd.
plot(result, index = 1)

## Summarize the trajectory. The summary includes the number of events
## by event type.
summary(result)

Run the code above in your browser using DataLab