sir(graph, beta, gamma, no.sim=100)
## S3 method for class 'sir':
time_bins(x, middle=TRUE)
## S3 method for class 'sir':
median(x, na.rm=FALSE)
## S3 method for class 'sir':
quantile(x, comp=c("NI", "NS", "NR"), prob, ...)
sir
object, returned by the sir
function.NA
values.
sir
objects do not contain any NA
values currently,
so this argument is effectively ignored.NI
is infected agents, NS
is susceptibles,
NR
stands for recovered.sir
the results are returned in an object of class
sir
median
The function sir
simulates the model.
Function time_bins
bins the simulation steps, using the
Freedman-Diaconis heuristics to determine the bin width.
Function median
and quantile
calculate the median and
quantiles of the results, respectively, in bins calculated with
time_bins
.
plot.sir
to conveniently plot the resultsg <- erdos.renyi.game(100, 100, type="gnm")
sm <- sir(g, beta=5, gamma=1)
plot(sm)
Run the code above in your browser using DataCamp Workspace