fastbeta | R Documentation |
Generates a discrete approximation of a time-varying infectious disease transmission rate from an equally spaced disease incidence time series and other data.
fastbeta(series, sigma = 1, gamma = 1, delta = 0,
m = 1L, n = 1L, init, ...)
series |
a “multiple time series” object, inheriting from class
|
sigma , gamma , delta |
non-negative numbers. |
m |
a non-negative integer indicating a number of latent stages. |
n |
a positive integer indicating a number of infectious stages. |
init |
a numeric vector of length |
... |
optional arguments passed to |
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; and
constant 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.
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.
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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1371/journal.pcbi.1008124")}
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.ts(seir.ts02[, c("Z", "B")], mu = a[["mu"]](0))
args <- c(list(series = series),
a[c("sigma", "gamma", "delta", "m", "n", "init")])
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"
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.