simSEIR | R Documentation |
Simulate an epidemic under the specified conditions.
simSEIR( S0, E0, I0, N, tau, beta, X, rateE, infPeriodSpec = c("exp", "PS", "IDD"), infExpParams = NULL, infPSParams = NULL, infIDDParams = NULL )
S0 |
Integer, number of initially susceptible individuals. |
E0 |
Integer, number of initially exposed individuals. |
I0 |
Integer, number of initially infectious individuals. |
N |
Integer, population size. |
tau |
Integer, number of days to simulate over. |
beta |
vector with elements for each column of |
X |
The design matrix corresponding to the intensity process over epidemic time. |
rateE |
The rate of the exponentially distributed time spent in the latent period. |
infPeriodSpec |
A character indicating which model for the infectious period will be used. |
infExpParams |
A list giving parameters specific to the exponentially distributed infectious period. See details for specifics. |
infPSParams |
A list giving parameters specific to the path-specific distributed infectious period. See details for specifics. |
infIDDParams |
A list giving parameters specific to the infectious duration-dependent infectious period. See details for specifics. |
simSEIR
simulates an epidemic according to the stochastic SEIR
chain binomial formulation. Epidemics may be simulated according to three
possible specifications of the infectious period: the exponential distribution,
the path-specific (PS) approach of Porter and Oleson (2013),
or the infectious-duration dependent (IDD) formulation of Ward et al. (upcoming).
infPeriodSpec
determines which model will be used to simulate the epidemic.
Model specific parameter values are entered using either infExpParams
,
infPSParams
, or infIDDParams
.
All models use the beta
parameter vector associated with each column of the
matrix X
to describe transmission over epidemic time. All models
assume exponentially distributed time spent in the latent period with rate
parameter, rateE
.
For the exponential model infPeriodSpec = 'exp'
, only one additional
parameter needs to be specified in infExpParams
: rateI
, which is
the rate parameter associated with the removal probability.
For the path-specific model infPeriodSpec = 'PS'
, infPSParams
should contain three elements: dist
, maxInf
, and psParams
.
dist
gives the distribution used to describe the length of time spent
in the infectious period Currently only the exponential ("exp"
),
gamma ("gamma"
), and Weibull ("weibull"
) distributions are supported.
maxInf
corresponds to the maximum length of time an individual can
spend in the infectious compartment, at which point the removal probability
becomes 1. psParams
must provide a list of parameter values for the parameters
associated with the chosen distribution. For dist = 'gamma'
, these are
the shape
and rate
parameters and for dist = 'weibull'
,
these are the shape
and scale
parameters.
For the infectious-duration dependent model infPeriodSpec = 'IDD'
,
infIDDParams
should contain three elements: maxInf
, iddFun
,
and iddParams
. maxInf
corresponds to the total length of time
each individual spends in the infectious compartment. iddFun
gives
the IDD function used to describe the IDD curve. iddParams
must provide
a list of parameter values for the parameters associated with the chosen iddFun
.
For example, if iddFun = dgammaIDD
, these are the shape
and
rate
parameters.
A list with elements N, S0, E0, I0, S, E, I, R, Estar, Istar, Rstar
,
which provide the simulated number of individuals in each compartment over time
(S, E, I, R
) and transitioning into each compartment over epidemic time
(Estar, Istar, Rstar
). Also returns the initial conditions as specified
by the user.
Porter, Aaron T., and Oleson, Jacob J. "A path-specific SEIR model for use with general latent and infectious time distributions." Biometrics 69.1 (2013): 101-108.
# simulate epidemic over 100 days tau <- 100 # specify the design matrix so there is a change point in transmission at time 50 X <- cbind(1, c(rep(0, 49), rep(1, tau - 49))) # simulate using exponentially distributed infectious period datExp <- simSEIR(S0 = 999, E0 = 0, I0 = 1, N = 1000, tau = tau, beta = c(0.1, -2), X = X, rateE = 0.1, infPeriodSpec = 'exp', infExpParams = list(rateI = 0.2)) # plot incidence curve plot(datExp$Istar, type = 'l', main = 'Incidence', xlab = 'Epidemic Time', ylab = 'Count') # simulate using IDD infectious period using the gamma PDF datIDD <- simSEIR(S0 = 999, E0 = 0, I0 = 1, N = 1000, tau = tau, beta = c(0.7, -1.5), X = X, rateE = 0.1, infPeriodSpec = 'IDD', infIDDParams = list(maxInf = 14, iddFun = dgammaIDD, iddParams = list(shape = 4, rate = 1))) # plot incidence curve plot(datIDD$Istar, type = 'l', main = 'Incidence', xlab = 'Epidemic Time', ylab = 'Count')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.