Functions to extract summary statistics from models, including transition probabilities, active cases, and outbreak sizes.
Arguments
- x
An object of class
epiworld_sir,epiworld_seir, etc. (any model).
Value
The
get_transition_probabilityfunction returns an object of classmatrix.
The function
get_active_casesreturns 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_sizereturns a data.frame with four columns:date,virus_id,virus, andoutbreak_sizeindicating 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.9111942 0.08880584 0.0000000 0.0000000
#> Exposed 0.0000000 0.85771914 0.1422809 0.0000000
#> Infected 0.0000000 0.00000000 0.6991377 0.3008623
#> 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 1177
#> 4 3 0 Disease 1415
#> 5 4 0 Disease 1651
#> 6 5 0 Disease 1975
# 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 1221
#> 4 3 0 Disease 1529
#> 5 4 0 Disease 1850
#> 6 5 0 Disease 2289
