% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cori_rt.R
\name{cori_rt}
\alias{cori_rt}
\title{Cori-style renewal-equation R_t estimator}
\usage{
cori_rt(
  incidence,
  tau = 7L,
  si_mean = 5.5,
  si_sd = 2.5,
  prior_a = 1,
  prior_b = 5
)
}
\arguments{
\item{incidence}{Numeric vector of length \eqn{T}. Daily case counts.}

\item{tau}{Integer. Sliding window length (days). Default 7.}

\item{si_mean}{Positive numeric. Serial interval mean (days). Default 5.5.}

\item{si_sd}{Positive numeric. Serial interval SD (days). Default 2.5.}

\item{prior_a}{Positive numeric. Gamma prior shape on \eqn{R_t}. Default 1.}

\item{prior_b}{Positive numeric. Gamma prior scale on \eqn{R_t}. Default 5.}
}
\value{
A data frame with columns \code{t}, \code{Rt_mean}, \code{Rt_lo},
\code{Rt_hi} (NaN where incidence is too low to estimate).
}
\description{
An in-house implementation of the sliding-window renewal-equation
\eqn{R_t} estimator following Cori et al. (2013).
}
\details{
\strong{Important:} This is \emph{not} a call to the R \pkg{EpiEstim} package and
numerical agreement with that package has not been independently verified.
It is provided for \emph{illustrative comparison of estimands} only: the
renewal-equation \eqn{R_t} and the compartmental \eqn{R_t} target different
quantities once susceptible depletion is non-negligible (see Section 6.2 of
Feng and Wang 2025).

The estimator uses gamma-conjugate updating over a \eqn{\tau}-day sliding
window. The posterior is
\deqn{R_t \mid \text{data} \sim \mathrm{Gamma}(a + \sum I,\;
  [1/b + \Lambda]^{-1})}
where \eqn{\Lambda = \sum_{s=t-\tau+1}^{t} \Lambda_s} and
\eqn{\Lambda_s = \sum_{k \geq 1} w_k I_{s-k}} is daily infectiousness.
}
\examples{
set.seed(1)
inc <- rpois(60, lambda = c(rep(50, 20), seq(50, 200, length=20),
                            seq(200, 30, length=20)))
rt  <- cori_rt(inc, tau = 7, si_mean = 5.5, si_sd = 2.5)
plot(rt$t, rt$Rt_mean, type = "l", ylim = c(0, 4),
     xlab = "Day", ylab = expression(R[t]),
     main = "Cori-style Rt estimate")
abline(h = 1, lty = 2)
}
\references{
Cori, A., Ferguson, N. M., Fraser, C. and Cauchemez, S. (2013).
A new framework and software to estimate time-varying reproduction numbers
during epidemics. \emph{American Journal of Epidemiology},
178(9):1505--1512.
}
