fastbeta {fastbeta} | R Documentation |
Estimate a Time-Varying Infectious Disease Transmission Rate
Description
Generates a discrete approximation of a time-varying infectious disease transmission rate from an equally spaced incidence time series and other data.
Usage
fastbeta(series, sigma = gamma, gamma = 1, delta = 0,
init, m = length(init) - n - 2L, n = 1L, ...)
Arguments
series |
a “multiple time series” object, inheriting from class
|
sigma , gamma , delta |
non-negative numbers. |
init |
a numeric vector of length |
m |
a non-negative integer indicating a number of latent stages. |
n |
a positive integer indicating a number of infectious stages. |
... |
optional arguments passed to |
Details
The algorithm implemented by fastbeta
is based on an SEIR model
with
-
m
latent stages (E^{i}
,i = 1,\ldots,m
); -
n
infectious stages (I^{j}
,j = 1,\ldots,n
); time-varying rates
\beta
,\nu
, and\mu
of transmission, birth, and natural death; andconstant rates
m \sigma
,n \gamma
, and\delta
of removal from each latent, infectious, and recovered compartment, where removal from the recovered compartment implies return to the susceptible compartment (loss of immunity).
It is derived by linearizing of the system of ordinary differential equations
\begin{alignedat}{10}
\text{d} & S &{} / \text{d} t
&{} = {}& \delta &R &{} - ( && \lambda(t) &{} + \mu(t)) S &{} + \nu(t) \\
\text{d} & E^{ 1} &{} / \text{d} t
&{} = {}& \lambda(t) &S &{} - ( && m \sigma &{} + \mu(t)) E^{ 1} &{} \\
\text{d} & E^{i + 1} &{} / \text{d} t
&{} = {}& m \sigma &E^{i} &{} - ( && m \sigma &{} + \mu(t)) E^{i + 1} &{} \\
\text{d} & I^{ 1} &{} / \text{d} t
&{} = {}& m \sigma &E^{m} &{} - ( && n \gamma &{} + \mu(t)) I^{ 1} &{} \\
\text{d} & I^{j + 1} &{} / \text{d} t
&{} = {}& n \gamma &I^{j} &{} - ( && n \gamma &{} + \mu(t)) I^{j + 1} &{} \\
\text{d} & R &{} / \text{d} t
&{} = {}& n \gamma &I^{n} &{} - ( && \delta &{} + \mu(t)) R &{}
\end{alignedat} \\
\lambda(t) = \beta(t) \sum_{j} I^{j}
and substituting actual or estimated incidence and births for definite
integrals of \lambda S
and \nu
. This procedure yields a
system of linear difference equations from which one recovers a discrete
approximation of \beta
:
\begin{alignedat}{17}
&E_{t + 1}^{ 1}
&{} = {}& [(1 - \tfrac{1}{2} ( & m \sigma + \mu_{t})) & E_{t}^{ 1} & & & & & & & &{} + Z_{t + 1} & ] &{} /
[1 + \tfrac{1}{2} ( & m \sigma + \mu_{t + 1})] \\
&E_{t + 1}^{i + 1}
&{} = {}& [(1 - \tfrac{1}{2} ( & m \sigma + \mu_{t})) & E_{t}^{i + 1} &{} + {}& \tfrac{1}{2} & m \sigma ( & E_{t}^{i} &{} + {}& E_{t + 1}^{i} & ) & & ] &{} /
[1 + \tfrac{1}{2} ( & m \sigma + \mu_{t + 1})] \\
&I_{t + 1}^{ 1}
&{} = {}& [(1 - \tfrac{1}{2} ( & n \gamma + \mu_{t})) & I_{t}^{ 1} &{} + {}& \tfrac{1}{2} & m \sigma ( & E_{t}^{m} &{} + {}& E_{t + 1}^{m} & ) & & ] &{} /
[1 + \tfrac{1}{2} ( & n \gamma + \mu_{t + 1})] \\
&I_{t + 1}^{j + 1}
&{} = {}& [(1 - \tfrac{1}{2} ( & n \gamma + \mu_{t})) & I_{t}^{j + 1} &{} + {}& \tfrac{1}{2} & n \gamma ( & I_{t}^{j} &{} + {}& I_{t + 1}^{j} & ) & & ] &{} /
[1 + \tfrac{1}{2} ( & n \gamma + \mu_{t + 1})] \\
&R_{t + 1}
&{} = {}& [(1 - \tfrac{1}{2} ( & \delta + \mu_{t})) & R_{t} &{} + {}& \tfrac{1}{2} & n \gamma ( & I_{t}^{n} &{} + {}& I_{t + 1}^{n} & ) & & ] &{} /
[1 + \tfrac{1}{2} ( & \delta + \mu_{t + 1})] \\
&S_{t + 1}
&{} = {}& [(1 - \tfrac{1}{2} ( & \mu_{t})) & S_{t} &{} + {}& \tfrac{1}{2} & \delta ( & R_{t} &{} + {}& R_{t + 1} & ) &{} - Z_{t + 1} &{} + B_{t + 1}] &{} /
[1 + \tfrac{1}{2} ( & \mu_{t + 1})]
\end{alignedat} \\
\beta_{t} = (Z_{t} + Z_{t + 1}) / (2 S_{t} \sum_{j} I_{t}^{j})
where we use the notation
X_{t} \sim X(t) : X = S, E^{i}, I^{j}, R, Z, B, \mu, \beta \\
\begin{aligned}
Z(t) &= \int_{t - 1}^{t} \lambda(s) S(s) \, \text{d} s \\
B(t) &= \int_{t - 1}^{t} \nu(s) \, \text{d} s
\end{aligned}
and it is understood that the independent variable t
is a unitless
measure of time relative to the spacing of the substituted time series
of incidence and births.
Value
A “multiple time series” object, inheriting from class
mts
, with 1+m+n+1+1
columns (named S
,
E
, I
, R
, and beta
) storing the result of the
iteration described in ‘Details’. It is completely parallel to
argument series
, having the same tsp
attribute.
References
Jagan, M., deJonge, M. S., Krylova, O., & Earn, D. J. D. (2020). Fast estimation of time-varying infectious disease transmission rates. PLOS Computational Biology, 16(9), Article e1008124, 1-39. doi:10.1371/journal.pcbi.1008124
Examples
if (requireNamespace("adaptivetau")) withAutoprint({
data(seir.ts02, package = "fastbeta")
a <- attributes(seir.ts02)
str(seir.ts02)
plot(seir.ts02)
## We suppose that we have perfect knowledge of incidence,
## births, and the data-generating parameters
series <- cbind(seir.ts02[, c("Z", "B")], mu = a[["mu"]](0))
colnames(series) <- c("Z", "B", "mu") # FIXME: stats:::cbind.ts mangles dimnames
args <- c(list(series = series),
a[c("sigma", "gamma", "delta", "init", "m", "n")])
str(args)
X <- do.call(fastbeta, args)
str(X)
plot(X)
plot(X[, "beta"], ylab = "transmission rate")
lines(a[["beta"]](time(X)), col = "red") # the "truth"
})