Learn R Programming

EpiModel (version 0.95)

plot.epiICM: Plot Simulations from a Individual Contact Epidemic Model

Description

This function plots values from an individual contact epidemic model simulated with epiICM.

Usage

## S3 method for class 'epiICM':
plot(x, y, popfrac, sim.lines = FALSE, sims, sim.col,
  sim.lwd, sim.alpha, mean.line = TRUE, mean.extinct = TRUE, mean.col,
  mean.lwd, mean.lty, qnts, qnts.col, qnts.alpha, leg, leg.cex, xlim, ylim,
  main, axs, add = FALSE, ...)

Arguments

x
an EpiModel object of class epiICM.
y
output compartments or flows from epiICM object to plot.
popfrac
if TRUE, plot prevalence of values rather than numbers (see details).
sim.lines
if TRUE, plot individual simulation lines.
sims
a vector representing which individual simulation lines to plot, with default to plot all lines.
sim.col
a vector of any standard R color format for simulation lines.
sim.lwd
line width for simulation lines.
sim.alpha
transparency level for simulation lines, where 0 = transparent and 1 = opaque (see transco).
mean.line
if TRUE, plot mean of simulations across time.
mean.extinct
if TRUE, include extinct simulations in mean calculation (see details).
mean.col
a vector of any standard R color format for mean lines.
mean.lwd
line width for mean lines.
mean.lty
line type for mean lines.
qnts
if numeric, plot polygon of simulation quantiles based on the range implied by the argument (see details). If FALSE, supress polygon plot.
qnts.col
a vector of any standard R color format for polygons.
qnts.alpha
transparency level for quantile polygons, where 0 = transparent and 1 = opaque (see transco).
leg
if TRUE, plot default legend.
leg.cex
a numeric value to scale the legend size.
xlim
x-axis scale limits for plot, with default calculated based on model time steps.
ylim
y-axis scale limits for plot, with default calculated based on range of data.
main
character string for main plot title.
axs
plot axis type (see par for details), with default to "r".
add
if TRUE, new plot is not called and lines are added to existing plot.
...
additional arguments to pass to main plot (see plot.default).

Details

This plotting function will extract the simulation output values from an object of class epiICM and plot the requested time series data of disease prevalence and other results. The summary statistics that the function calculates and plots are individual simulation lines, means of the individual simulation lines, and quantiles of those individual simulation lines. The mean line, toggled on with mean.line=TRUE is calculated as the row mean across simulations at each time step.

Compartment prevalences are the size of a compartment over some denominator. To plot the raw numbers from any compartment, use popfrac=FALSE; this is the default for any plots of flows. The popfrac parameter calculates and plots the denominators of all specified compartments using these rules: 1) for one-group models, the prevalence of any compartment is the compartment size divided by the total population size; 2) for two-group models, the prevalence of any compartment is the compartment size divided by the group population size.

The quantiles show the range of outcome values within a certain specified quantile range. By default, the interquartile range is shown. This is specified by qnts=0.5, that is the middle 50wanted to show the middle 95specify qnts=0.95. To toggle off the polygons where they are plotted by default, specify qnts=FALSE.

See Also

epiICM

Examples

Run this code
# Plotting multiple compartment values automatically
mod <- epiICM(type="SIR", s.num=500, i.num=1,
             trans.rate=0.2, act.rate=0.25, rec.rate=1/50,
             nsteps=1000, nsims=10)
plot(mod)

# Plot only infecteds and show individual simulation lines
mod <- epiICM(type="SI", s.num=500, i.num=1,
              trans.rate=0.2, act.rate=0.2,
              nsteps=500, nsims=10)
plot(mod, y="i.num", sim.lines=TRUE)

Run the code above in your browser using DataLab