Learn R Programming

EpiModel (version 0.95)

comp.plot: Plot Compartment Diagram from Deterministic or Stochastic Model

Description

This function plots a compartment diagram for all three classes of epidemic models in EpiModel: epiDCM, epiICM, and epiNet.simTrans.

Usage

comp.plot(x, time, run, digits, ...)

## S3 method for class 'epiDCM': comp.plot(x, time, run = 1, digits = 3, ...)

## S3 method for class 'epiICM': comp.plot(x, time = 1, run, digits = 3, ...)

## S3 method for class 'epiNet.simTrans': comp.plot(x, time = 1, run, digits = 3, ...)

Arguments

x
an EpiModel object of class epiDCM, epiICM, or epiNet.simTrans
time
timestep at which summary data is extracted
run
model run number for plotting, only for epiDCM class models with multiple runs (sensitivity analyses)
digits
number of significant digits to print
...
additional arguments passed to plot (not currently used)

Details

The comp.plot function is a visual summary of an EpiModel at a specific point in time. The information contained in comp.plot is essentially the same as in the summary functions for a model, but presented in a way commonly seen in the epidemiological literature.

For epiDCM class plots, one must specify the specific run number to be plotted, in case the object contains multiple runs from a sensitivity analysis. For epiICM and epiNet.simTrans class plots, the run argument is not used because the plots show the means and standard deviations for each state size and flow at the specified timestep.

The functionality of these plots is currently limited to one-group or one- mode models in each of the three model classes, and that functionality will be expanded in future EpiModel releases.

Examples

Run this code
# Example for epiDCM: SIR model with varying act.rate
mod <- epiDCM(type="SIR", s.num = 1000, i.num = 1,
              trans.rate = 0.2, act.rate = 5:7, rec.rate = 1/3,
              b.rate = 1/90, ds.rate = 1/100, di.rate = 1/35,
              dr.rate = 1/100, nsteps = 25)
comp.plot(mod, time=25, run=3)

# Example for epiICM: SIR model with 3 simulations
modICM <- epiICM(type = "SIR", s.num = 500, i.num = 1,
                 trans.rate = 0.2, act.rate = 3,
                 rec.rate = 1/50, b.rate = 1/100,
                 ds.rate = 1/100, di.rate = 1/90, dr.rate = 1/100,
                 nsteps = 25, nsims = 3)
comp.plot(modICM, time=25)

Run the code above in your browser using DataLab