fastbeta | R Documentation |
Generates a discrete time estimate of a transmission rate
\beta(t)
from an equally spaced incidence time series
and other data.
fastbeta(series, constants, ...)
series |
a “multiple time series” object, inheriting from
class |
constants |
a numeric vector of the form
|
... |
optional arguments passed to |
fastbeta
works by discretizing the system of ordinary
differential equations
\begin{aligned}
\frac{\text{d} S}{\text{d} t} &= \nu(t) - \beta(t) S I + \delta R - \mu(t) S \\
\frac{\text{d} I}{\text{d} t} &= \beta(t) S I - \gamma I - \mu(t) I \\
\frac{\text{d} R}{\text{d} t} &= \gamma I - \delta R - \mu(t) R
\end{aligned}
where t
is understood to be a unitless measure of time
relative to the duration of an observation interval, then computing
the iteration
\begin{aligned}
I_{t + 1} &= \frac{(1 - \frac{1}{2} (\gamma + \mu_{t})) I_{t} + Z_{t + 1}}{
1 + \frac{1}{2} (\gamma + \mu_{t + 1})} \\
R_{t + 1} &= \frac{(1 - \frac{1}{2} (\delta + \mu_{t})) R_{t} + \frac{1}{2} \gamma (I_{t} + I_{t + 1})}{
1 + \frac{1}{2} (\delta + \mu_{t + 1})} \\
S_{t + 1} &= \frac{(1 - \frac{1}{2} \mu_{t}) S_{t} - Z_{t + 1} + B_{t + 1} + \frac{1}{2} \delta (R_{t} + R_{t + 1})}{
1 + \frac{1}{2} \mu_{t + 1}} \\
\beta_{t} &= \frac{Z_{t} + Z_{t + 1}}{2 S_{t} I_{t}}
\end{aligned}
where
\begin{aligned}
X_{t} &\sim X(t) \quad [X = \beta, \mu, S, I, R] \\
Z_{t} &\sim \int_{t - 1}^{t} \beta(s) S(s) I(s) \, \text{d} s \\
B_{t} &\sim \int_{t - 1}^{t} \nu(s) \, \text{d} s
\end{aligned}
and it is understood that indexing starts at t = 0
.
Z_{t}
, B_{t}
, and \mu_{t}
denote
incidence and births between times t - 1
and t
and the
per capita natural mortality rate at time t
; they are supplied
together as argument series
.
A “multiple time series” object, inheriting from class
mts
, with four columns (named S
, 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")}
data(sir.e02, package = "fastbeta")
a <- attributes(sir.e02)
str(sir.e02)
plot(sir.e02)
## We suppose that we have perfect knowledge of incidence,
## births, and the data-generating parameters
series <- cbind(sir.e02[, c("Z", "B")], mu = a[["mu"]](0))
colnames(series) <- c("Z", "B", "mu") # FIXME: stats:::cbind.ts mangles dimnames
constants <- c(S0 = sir.e02[[1L, "S"]],
I0 = sir.e02[[1L, "I"]],
R0 = sir.e02[[1L, "R"]],
gamma = a[["gamma"]],
delta = a[["delta"]])
X <- fastbeta(series, constants)
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.