estimate_Re() takes the number of infections through time and computes the Re value through time (also known as Rt).

estimate_Re(
  incidence_data,
  estimation_method = "EpiEstim sliding window",
  simplify_output = FALSE,
  ...
)

Arguments

incidence_data

An object containing incidence data through time. It can either be:

  • A list with two elements:

    1. A numeric vector named values: the incidence recorded on consecutive time steps.

    2. An integer named index_offset: the offset, counted in number of time steps, by which the first value in values is shifted compared to a reference time step This parameter allows one to keep track of the date of the first value in values without needing to carry a date column around. A positive offset means values are delayed in the future compared to the reference values. A negative offset means the opposite.

  • A numeric vector. The vector corresponds to the values element descrived above, and index_offset is implicitely zero. This means that the first value in incidence_data is associated with the reference time step (no shift towards the future or past).

estimation_method

string. Method used to estimate reproductive number values through time from the reconstructed infection timings. Available options are:

simplify_output

boolean. Simplify the output when possible?

...

Arguments passed on to .estimate_Re_EpiEstim_sliding_window, .estimate_Re_EpiEstim_piecewise_constant

estimation_window

Use with estimation_method = "EpiEstim sliding window" Positive integer value. Number of data points over which to assume Re to be constant.

import_incidence_input

NULL or module input object. List with two elements:

  1. A numeric vector named values: the incidence recorded on consecutive time steps.

  2. An integer named index_offset: the offset, counted in number of time steps, by which the first value in values is shifted compared to a reference time step This parameter allows one to keep track of the date of the first value in values without needing to carry a date column around. A positive offset means values are delayed in the future compared to the reference values. A negative offset means the opposite.

If not NULL, this data represents recorded imported cases. And then incidence_input represents only local cases.

minimum_cumul_incidence

Numeric value. Minimum number of cumulated infections before starting the Re estimation. Default is 12 as recommended in Cori et al., 2013.

mean_serial_interval

Numeric positive value. mean_si for estimate_R

std_serial_interval

Numeric positive value. std_si for estimate_R

mean_Re_prior

Numeric positive value. mean prior for estimate_R

output_HPD

Boolean. If TRUE, return the highest posterior density interval with the output.

interval_ends

Use with estimation_method = "EpiEstim piecewise constant" Integer vector. Optional argument. If provided, interval_ends overrides the interval_length argument. Each element of interval_ends specifies the right boundary of an interval over which Re is assumed to be constant for the calculation. Values in interval_ends must be integer values corresponding with the same numbering of time steps as given by incidence_input. In other words, interval_ends and incidence_input, use the same time step as the zero-th time step.

interval_length

Use with estimation_method = "EpiEstim piecewise constant" Positive integer value. Re is assumed constant over steps of size interval_length.

Value

A list with two elements:

  1. A numeric vector named values: the result of the computations on the input data.

  2. An integer named index_offset: the offset, counted in number of time steps, by which the result is shifted compared to an index_offset of 0. This parameter allows one to keep track of the date of the first value in values without needing to carry a date column around. A positive offset means values are delayed in the future compared to the reference values. A negative offset means the opposite. Note that the index_offset of the output of the function call accounts for the (optional) index_offset of the input.

If index_offset is 0 and simplify_output = TRUE, the index_offset is dropped and the values element is returned as a numeric vector.

If output_HPD = TRUE (additional parameter), the highest posterior density interval boundaries are output along with the mean Re estimates. In that case, a list of three lists is returned:

  • Re_estimate contains the Re estimates.

  • Re_highHPD and Re_lowHPD contain the higher and lower boundaries of the HPD interval, as computed by estimate_R

If, in addition, simplify_output = TRUE, then the 3 elements are merged into a single dataframe by merge_outputs(). A date column can be added to the dataframe by passing an extra ref_date argument (see merge_outputs for details).

a module output object. Re estimates.

Details

The incidence input should represent infections, as opposed to representing delayed observations of infections. If the incidence data represents delayed observations of infections, one should first reconstruct the incidence of infections using deconvolve_incidence() or get_infections_from_incidence() which wraps around it and includes a smoothing step of the delayed observations.

estimate_Re() wraps around the estimate_R() function of the EpiEstim package from Cori et al, 2013. estimate_Re() allows for two types of Re estimations:

  1. A sliding-window estimation. For each time step T, the Re(T) value is computed by assuming that Re is constant for time steps (T-X+1, ..., T-1, T), with X being the sliding window size. This option is chosen by setting estimation_method = "EpiEstim sliding window"

  2. A piecewise-constant estimation. Re(t) is computed as being a piecewise-constant function of time. The length of each step can be a fixed number of time steps. That number is specified using the interval_length parameter. The length of each step can also be irregular. This can be useful if the boundaries of the steps are meant to coincide with particular events such as the implementation or cancellation of public health interventions. The right boundaries of the steps are specified using the interval_ends parameter. This option is chosen by setting estimation_method = "EpiEstim piecewise constant"

See also

Examples

## Building incidence_data # estimate_Re assumes incidence_data represents infections, not delayed noisy # observations of infections. Thus, we need to first smooth the incidence data # and then perform a deconvolution step. For more details, see the smooth_incidence # and deconvolve_incidence functions. shape_incubation <- 3.2 scale_incubation <- 1.3 delay_incubation <- list(name = "gamma", shape = shape_incubation, scale = scale_incubation) shape_onset_to_report = 2.7 scale_onset_to_report = 1.6 delay_onset_to_report <- list(name="gamma", shape = shape_onset_to_report, scale = scale_onset_to_report) smoothed_incidence <- smooth_incidence(HK_incidence_data$case_incidence) deconvolved_incidence <- deconvolve_incidence( smoothed_incidence, delay = list(delay_incubation, delay_onset_to_report) ) ## Basic usage of estimate_Re Re_estimate_1 <- estimate_Re(incidence_data = deconvolved_incidence) ## Advanced usage of estimate_Re # Incorporating prior knowledge over Re. Here, Re is assumed constant over a time # frame of one week, with a prior mean of 1.25. Re_estimate_2 <- estimate_Re( incidence_data = deconvolved_incidence, estimation_method = 'EpiEstim piecewise constant', interval_length = 7, mean_Re_prior = 1.25 ) # Incorporating prior knowledge over the disease. Here, the mean of the serial # interval is assumed to be 5 days, and the standard deviation is assumed to be # 2.5 days. Re_estimate_3 <- estimate_Re( incidence_data = deconvolved_incidence, mean_serial_interval = 5, std_serial_interval = 2.5 ) # Incorporating prior knowledge over the epidemic. Here, it is assumed that Re # changes values 4 times during the epidemic, so the intervals over which Re is # assumed to be constant are passed as a parameter. last_interval_index <- length(deconvolved_incidence$values) + deconvolved_incidence$index_offset Re_estimate_4 <- estimate_Re( incidence_data = deconvolved_incidence, estimation_method = "EpiEstim piecewise constant", interval_ends = c(50, 75, 100, 160, last_interval_index) ) # Recovering the Re HPD as well. Re_estimate_5 <- estimate_Re( incidence_data = deconvolved_incidence, output_HPD = TRUE )