1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/epi.R
\name{plot.sir}
\alias{plot.sir}
\title{Plotting the results on multiple SIR model runs}
\usage{
\method{plot}{sir}(x, comp = c("NI", "NS", "NR"), median = TRUE,
quantiles = c(0.1, 0.9), color = NULL, median_color = NULL,
quantile_color = NULL, lwd.median = 2, lwd.quantile = 2,
lty.quantile = 3, xlim = NULL, ylim = NULL, xlab = "Time",
ylab = NULL, ...)
}
\arguments{
\item{x}{The output of the SIR simulation, coming from the \code{\link{sir}}
function.}
\item{comp}{Character scalar, which component to plot. Either \sQuote{NI}
(infected, default), \sQuote{NS} (susceptible) or \sQuote{NR} (recovered).}
\item{median}{Logical scalar, whether to plot the (binned) median.}
\item{quantiles}{A vector of (binned) quantiles to plot.}
\item{color}{Color of the individual simulation curves.}
\item{median_color}{Color of the median curve.}
\item{quantile_color}{Color(s) of the quantile curves. (It is recycled if
needed and non-needed entries are ignored if too long.)}
\item{lwd.median}{Line width of the median.}
\item{lwd.quantile}{Line width of the quantile curves.}
\item{lty.quantile}{Line type of the quantile curves.}
\item{xlim}{The x limits, a two-element numeric vector. If \code{NULL}, then
it is calculated from the data.}
\item{ylim}{The y limits, a two-element numeric vector. If \code{NULL}, then
it is calculated from the data.}
\item{xlab}{The x label.}
\item{ylab}{The y label. If \code{NULL} then it is automatically added based
on the \code{comp} argument.}
\item{\dots}{Additional arguments are passed to \code{plot}, that is run
before any of the curves are added, to create the figure.}
}
\value{
Nothing.
}
\description{
This function can conveniently plot the results of multiple SIR model
simulations.
}
\details{
The number of susceptible/infected/recovered individuals is plotted over
time, for multiple simulations.
}
\examples{
g <- sample_gnm(100, 100)
sm <- sir(g, beta=5, gamma=1)
plot(sm)
}
\author{
Eric Kolaczyk (\url{http://math.bu.edu/people/kolaczyk/}) and Gabor
Csardi \email{csardi.gabor@gmail.com}.
}
\references{
Bailey, Norman T. J. (1975). The mathematical theory of
infectious diseases and its applications (2nd ed.). London: Griffin.
}
\seealso{
\code{\link{sir}} for running the actual simulation.
}
\keyword{graphs}
|