Learn R Programming

SimInf (version 5.0.0)

susceptible: Susceptible

Description

Extracts the number of susceptible.

Usage

susceptible(model, ...)

# S4 method for SEIR susceptible(model, i = NULL, ...)

# S4 method for SIR susceptible(model, i = NULL, ...)

# S4 method for SISe susceptible(model, i = NULL, ...)

# S4 method for SISe3 susceptible(model, age = 1:3, i = NULL, ...)

# S4 method for SISe3_sp susceptible(model, age = 1:3, i = NULL, ...)

# S4 method for SISe_sp susceptible(model, i = NULL, ...)

Arguments

model

The model to extract the susceptible from

...

Additional arguments affecting the measure

i

Indices specifying the nodes to include when extracting the number of susceptible. Default is NULL, which includes all nodes.

age

For models with age categories, the age category to extract.

Examples

Run this code
# NOT RUN {
## Create an 'SIR' model with 5 nodes and initialize
## it to run over 10 days.
u0 <- data.frame(S = rep(99, 5), I = rep(1, 5), R = rep(0, 5))
model <- SIR(u0 = u0, tspan = 1:10, beta = 0.16, gamma = 0.077)

## Run the model and save the result
result <- run(model)

## Extract the number of susceptible individuals in each
## node after each time step in the simulation
susceptible(result)

## Extract the number of susceptible individuals in the
## first node after each time step in the simulation
susceptible(result, i = 1)

## Extract the number of susceptible individuals in the
## first and third node after each time step in the simulation
susceptible(result, i = c(1, 3))
# }

Run the code above in your browser using DataLab