Skip to contents

Functions to extract summary statistics from models, including transition probabilities, active cases, and outbreak sizes.

Usage

get_transition_probability(x)

get_active_cases(x)

get_outbreak_size(x)

Arguments

x

An object of class epiworld_sir, epiworld_seir, etc. (any model).

Value

  • The get_transition_probability function returns an object of class matrix.

  • The function get_active_cases returns a data.frame with four columns: date, virus_id, virus, and active_cases indicating the number of active cases (individuals with a virus) at each point in time.

  • The function get_outbreak_size returns a data.frame with four columns: date, virus_id, virus, and outbreak_size indicating the outbreak size per virus at each point in time.

See also

Other Summaries: epiworld-hospitalizations

Examples

# SEIR Connected model
seirconn <- ModelSEIRCONN(
  name              = "Disease",
  n                 = 10000,
  prevalence        = 0.1,
  contact_rate      = 2.0,
  transmission_rate = 0.8,
  incubation_days   = 7.0,
  recovery_rate     = 0.3
)

set.seed(937)
run(seirconn, 50)
#> _________________________________________________________________________
#> |Running the model...
#> |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| done.
#> |

# Retrieving the transition probability
get_transition_probability(seirconn)
#>             Susceptible    Exposed  Infected Recovered
#> Susceptible   0.9113965 0.08860354 0.0000000 0.0000000
#> Exposed       0.0000000 0.85694473 0.1430553 0.0000000
#> Infected      0.0000000 0.00000000 0.6974602 0.3025398
#> Recovered     0.0000000 0.00000000 0.0000000 1.0000000

# Get active cases
head(get_active_cases(seirconn))
#>   date virus_id   virus active_cases
#> 1    0        0 Disease         1000
#> 2    1        0 Disease         1000
#> 3    2        0 Disease         1131
#> 4    3        0 Disease         1346
#> 5    4        0 Disease         1611
#> 6    5        0 Disease         1988

# Get outbreak size
head(get_outbreak_size(seirconn))
#>   date virus_id   virus outbreak_size
#> 1    0        0 Disease          1000
#> 2    1        0 Disease          1000
#> 3    2        0 Disease          1178
#> 4    3        0 Disease          1466
#> 5    4        0 Disease          1820
#> 6    5        0 Disease          2297