estimate_rt {rtestim} | R Documentation |
Estimate Rt using smoothness-penalized Poisson likelihood
Description
The Effective Reproduction Number R_t
of an infectious
disease can be estimated by solving the smoothness penalized Poisson
regression (trend filtering) of the form:
\hat{\theta} = \arg\min_{\theta} \frac{1}{n} \sum_{i=1}^n (w_i e^{\theta_i} -
y_i\theta_i) + \lambda\Vert D^{(k+1)}\theta\Vert_1,
where R_t = e^{\theta}
, y_i
is the observed case count at day
i
, w_i
is the weighted past counts at day i
, \lambda
is the smoothness penalty, and D^{(k+1)}
is the (k+1)
-th order
difference matrix.
Usage
estimate_rt(
observed_counts,
korder = 3L,
dist_gamma = c(2.5, 2.5),
x = 1:n,
lambda = NULL,
nsol = 50L,
delay_distn = NULL,
delay_distn_periodicity = NULL,
lambdamin = NULL,
lambdamax = NULL,
lambda_min_ratio = 1e-04,
maxiter = 1e+05,
init = configure_rt_admm()
)
Arguments
observed_counts |
vector of the observed daily infection counts |
korder |
Integer. Degree of the piecewise polynomial curve to be
estimated. For example, |
dist_gamma |
Vector of length 2. These are the shape and scale for the assumed serial interval distribution. Roughly, this distribution describes the probability of an infectious individual infecting someone else after some period of time after having become infectious. As in most literature, we assume that this interval follows a gamma distribution with some shape and scale. |
x |
a vector of positions at which the counts have been observed. In an ideal case, we would observe data at regular intervals (e.g. daily or weekly) but this may not always be the case. May be numeric or Date. |
lambda |
Vector. A user supplied sequence of tuning parameters which
determines the balance between data fidelity and
smoothness of the estimated Rt; larger |
nsol |
Integer. The number of tuning parameters |
delay_distn |
in the case of a non-gamma delay distribution,
a vector or matrix (or |
delay_distn_periodicity |
Controls the relationship between the spacing
of the computed delay distribution and the spacing of |
lambdamin |
Optional value for the smallest |
lambdamax |
Optional value for the largest |
lambda_min_ratio |
If neither |
maxiter |
Integer. Maximum number of iterations for the estimation algorithm. |
init |
a list of internal configuration parameters of class
|
Value
An object with S3 class poisson_rt
. Among the list components:
-
observed_counts
the observed daily infection counts. -
x
a vector of positions at which the counts have been observed. -
weighted_past_counts
the weighted sum of past infection counts. -
Rt
the estimated effective reproduction rate. This is a matrix with each column corresponding to one value oflambda
. -
lambda
the values oflambda
actually used in the algorithm. -
korder
degree of the estimated piecewise polynomial curve. -
dof
degrees of freedom of the estimated trend filtering problem. -
niter
the required number of iterations for each value oflambda
. -
convergence
if number of iterations for each value oflambda
is less than the maximum number of iterations for the estimation algorithm.
Examples
y <- c(1, rpois(100, dnorm(1:100, 50, 15) * 500 + 1))
out <- estimate_rt(y)
out
plot(out)
out0 <- estimate_rt(y, korder = 0L, nsol = 40)
out0
plot(out0)