Learn R Programming

epiworldR (version 0.11.2.0)

epiworld-history: Model history and totals

Description

Functions to extract simulation history at total, variant, and tool levels, plus snapshot totals and a common plot method for history objects.

Usage

get_hist_total(x)

get_today_total(x)

# S3 method for epiworld_hist plot(x, y, ...)

get_hist_virus(x)

get_hist_tool(x)

Value

  • The get_hist_total function returns an object of class epiworld_hist_total.

  • The get_today_total function returns a named vector with the total number of individuals in each state at the end of the simulation.

  • The get_hist_virus function returns an object of class epiworld_hist_virus.

  • The get_hist_tool function returns an object of epiworld_hist_tool.

Arguments

x

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

y

Ignored.

...

In the case of plot methods, further arguments passed to graphics::plot.

Examples

Run this code
# 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
)

# Running the simulation for 50 steps (days)
set.seed(937)
run(seirconn, 50)

# Retrieving date, state, and counts dataframe including any added tools
get_hist_tool(seirconn)

# Retrieving overall date, state, and counts dataframe
head(get_hist_total(seirconn))

# Retrieving date, state, and counts dataframe by variant
head(get_hist_virus(seirconn))

# Snapshot of totals at end of simulation
get_today_total(seirconn)

Run the code above in your browser using DataLab