getr {linelistBayes}R Documentation

Calculate Time-Varying Reproduction Number R(t)

Description

This function estimates the time-varying reproduction number, R(t), based on the epidemic curve and serial interval distribution. R(t) is calculated for each day using a moving window approach, which involves taking a segment of the epidemic curve and applying a transformation based on the serial interval to estimate how many subsequent cases are generated by cases within the window.

Usage

getr(curve, si, size)

Arguments

curve

NumericVector representing the estimated epidemic curve with daily counts. This curve can include both back-calculated and nowcasted counts of infections.

si

NumericVector representing the serial interval distribution, expressed as a vector where each element corresponds to the probability of a delay of that many days between successive cases.

size

Integer specifying the size of the moving window used to calculate the mean reproduction number. This window size determines how many days are included in the calculation of R(t) at each step.

Value

NumericVector containing the estimated mean reproduction numbers (R(t)) for each day. The length of this vector will be the length of 'curve' minus 'size' minus one, reflecting the fact that the last few days do not have enough data to fill the window.

Examples

# Assume curve is a numeric vector of daily case counts and si is the serial interval distribution
curve <- rnorm(100, mean=10, sd=3)  # example epidemic curve
si <- rep(0.1, 10)  # example serial interval distribution
size <- 6  # example size of the moving window
getr(curve, si, size)

[Package linelistBayes version 1.0 Index]