Learn R Programming

epinet (version 2.1.11)

plot.epidemic: Plot the spread of an epidemic

Description

Plot the spread of an epidemic over a contact network.

Usage

# S3 method for epidemic
plot(x, lwd = 1, leaf.labs = TRUE, leaf.cex = 0.75,
    zero.at.start = FALSE, main = "Transmission Tree", xlab = "Time", 
    ylab= "", e.col = "black", i.col = "red", lty.transmission = 3, 
    marktransitions = TRUE, label.trans = "|", cex.trans = 0.5, ...)

Value

returns no value. Strictly invoked for the plotting side effect.

Arguments

x

a simulated epidemic, in the form of the output produced by SEIR.simulator.

lwd

line width for the (horizontal) line segments representing the exposed and infective periods for each individual. Also controls the line width for the (vertical) line segments showing the transmission pathways.

leaf.labs

boolean variable controlling whether the leaf labels (Node IDs) are displayed to the right of their infective period. Defaults to TRUE.

leaf.cex

Character expansion factor for the leaf labels, if they are displayed. Defaults to 0.75.

zero.at.start

boolean variable governing whether the epidemic times are shifted so that the epidemic begins at time zero. Defaults to FALSE.

main

main title for plot.

xlab

label for x axis on plot. Defaults to “Time”.

ylab

label for y axis on plot. Defaults to blank.

e.col

color to be used to plot the individuals' exposed periods on the plot. Defaults to black.

i.col

color to be used to plot the individuals' infective periods on the plot. Defaults to red.

lty.transmission

line type used to mark the (vertical) infection pathway on the plot. Defaults to 3 (dotted).

marktransitions

boolean variable indicating whether tick marks should be placed at the times where the individuals move from the exposed to the infective state. Defaults to TRUE.

label.trans

character used to mark transition points, if marktransitions is TRUE. Defaults to “|”.

cex.trans

magnification to be used to for transition labels, if marktransitions is TRUE. Defaults to 0.5.

...

other plotting arguments to be passed through to the call to plot() that draws the axes and titles.

Author

David Welch david.welch@auckland.ac.nz, Chris Groendyke cgroendyke@gmail.com

Details

Plots a simulated epidemic, or indicating the path that the infection took during the epidemic (the transmission tree) and the times that each node entered the Exposed, Infective, and Removed states. The default plotting parameter values work well for epidemics up to about 50 - 60 infecteds and the function requires at least 2 infecteds. For a larger number of infecteds, it is recommended to use pdf and adjust plotting dimensions.

Only works for full data, i.e., the transmission tree must be fully specified and all times for infected individuals must be known.

References

Groendyke, C. and Welch, D. 2018. epinet: An R Package to Analyze Epidemics Spread across Contact Networks, Journal of Statistical Software, 83-11.

See Also

SEIR.simulator for producing simulated epidemics. plot.epinet produces similar plots for transmission trees inferred as part of the epinet inference routine.

Examples

Run this code
# Simulate an epidemic through a network of 30
set.seed(3)
N <- 30
# Build dyadic covariate matrix (X)
# Have a single covariate for overall edge density; this is the Erdos-Renyi model
nodecov <- matrix(1:N, nrow = N)
dcm <- BuildX(nodecov)
# Simulate network and then simulate epidemic over network
examplenet <- SimulateDyadicLinearERGM(N, dyadiccovmat = dcm, eta = -1.8)
exampleepidemic <- SEIR.simulator(examplenet, N = 30, 
    beta = 0.3, ki = 2, thetai = 5, latencydist = "gamma")

# Plot the simulated epidemic
plot(exampleepidemic)

Run the code above in your browser using DataLab