Learn R Programming

SPOT (version 2.4.2)

plotSIRModel: plotSIRModel

Description

Plot of continuous time Markov chains (MarkovChain) SIR models.

Usage

plotSIRModel(x, days, N, n = 3, logy = FALSE)

Arguments

x

vector of four parameters. Used for parametrizing the MarkovChain model and calulation of fatalities.

p

num [0;1] proportion of confirmed cases

beta

num A numeric vector with the transmission rate from susceptible to infected where each node can have a different beta value. The vector must have length 1 or nrow(u0). If the vector has length 1, but the model contains more nodes, the beta value is repeated in all nodes.

gamma

num A numeric vector with the recovery rate from infected to recovered where each node can have a different gamma value. The vector must have length 1 or nrow(u0). If the vector has length 1, but the model contains more nodes, the beta value is repeated in all nodes.

CFR

num [0;1] proportion of fatalities

days

number of simulation steps, usually days (int). It will be used to generate (internally) a vector (length >= 1) of increasing time points where the state of each node is to be returned.

N

population size

n

number of nodes to be evaluated in the SIR model

logy

logical Plot logarithmic y axis. Default: FALSE

Value

plot

Details

SIR considers three compartments: S (susceptible), I (infected), and R (recovered). The timespan is calculated as tspan = 1:days.

Examples

Run this code
# NOT RUN {
require("SimInf")
# Result from \code{\link{parseTunedRegionModel}}, e.g., deModels:
# x = c(deModels$p, deModels$beta, deModels$gamma, deModels$CFR)
x = c(1e-05, 0.216764668858674, 0.204440265426977, 0.100982384347174)
plotSIRModel(x, days=1000, N = 83783945, n=10, logy=TRUE)
# }

Run the code above in your browser using DataLab