Learn R Programming

EpiModel (version 0.25)

plotABM: Plot Simulations from a Stochastic Epidemic Model

Description

This function plots values of compartments in an agent-based stochastic epidemic model.

Usage

plotABM(out, compart, simlines = TRUE, simcol, simalpha,
    medline = TRUE, medcol, medlwd, qnts = NULL, qntscol,
    xlim, ylim, axs, add = FALSE, ...)

Arguments

out
list of data frames containing runs from an epidemic model
compart
compartments to plot
simlines
logical operator to plot individual simulation lines
simcol
color for simulation lines (default is black)
simalpha
transparency level for sim lines, calculated automatically if not set
medline
logical operator to plot median of individual simulations at each timestep
medcol
color for median line
medlwd
line width for median line
qnts
plots polygon of simulation quantiles, with argument taking the quantile range. For 95% interval, set to 0.95.
qntscol
color for polygon
xlim
x-axis limits for plot, set to max of time if not set
ylim
y-axis limits for plot, calculated automatically if not set
axs
axis type (see par for details), default at 'i'
add
if TRUE then adds lines to existing plot
...
additional arguments to pass to plot

See Also

epiABM

Examples

Run this code
out <- epiABM(type='SI', s.num=500, i.num=1, beta=0.2, cont=0.2, nsteps=500, nsims=20)

par(mar=c(3,3,1,1), mgp=c(2,1,0))
plotABM(out, 'i.num', simlines=TRUE, medline=TRUE, qnts=0.5)

# Plotting multiple compartment values
plotABM(out, 'i.num', simlines=FALSE, medline=TRUE, medcol=1, qnts=0.5, axs='r')
plotABM(out, 's.num', simlines=FALSE, medline=TRUE, medcol=2, qnts=0.5, qntscol=2, add=TRUE)

Run the code above in your browser using DataLab