Skip to contents

Plot epidemic curves

Usage

# S3 method for class 'epiworld_model'
plot(x, auto_trunc = FALSE, main = get_name(x), ...)

Arguments

x

An object of class epiworld_model or epiworld_hist_virus or epiworld_hist.

auto_trunc

A logical value indicating whether to automatically truncate the plot (y-axis) (see details).

main

The main title for the plot.

...

Ignored.

Value

A plot of the epidemic curves for the specified model or history object.

Details

If auto_trunc is set to TRUE, the function will automatically truncate the plot based on the maximum date when the counts stop significantly changing by state. The benchmark value for determining significant change is set to 0.5% of the range of counts.

Examples

# Building and Initializing SEIR Model
sir <- ModelSIR(
  name = "COVID-19", prevalence = 0.01,
  transmission_rate = 0.9,
  recovery_rate = 0.1
)

# Adding a Small world population
agents_smallworld(
  sir,
  n = 1000,
  k = 5,
  d = FALSE,
  p = .01
)
# Running and printing
run(sir, ndays = 100, seed = 1912)
#> _________________________________________________________________________
#> Running the model...
#> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| done.
plot(sir, main = "SIR Model")