The main use of this function is to allow comparison with legacy code.

.get_delays_over_full_time_units(
  delays,
  date_of_interest,
  num_steps_in_a_unit = 7,
  min_number_cases
)

Arguments

delays

dataframe containing the empirical data. See Details.

date_of_interest

Date. Date for which the most recent recorded delays are sought.

num_steps_in_a_unit

Optional argument. Number of time steps in a full time unit (e.g. 7 if looking at weeks). If set, the delays used to build a particular delay distribution will span over a round number of such time units. This option is included for comparison with legacy code.

min_number_cases

integer. Minimal number of cases to build the empirical distribution from. If num_steps_in_a_unit is NULL, for any time step T, the min_number_cases records prior to T are used. If less than min_number_cases delays were recorded before T, then T is ignored and the min_number_cases earliest-recorded delays are used. If num_steps_in_a_unit is given a value, a similar same procedure is applied, except that, now at least min_number_cases must be taken over a round number of time units. For example, if num_steps_in_a_unit = 7, and time steps represent consecutive days, to build the distribution for time step T, we find the smallest number of weeks starting from T and going in the past, for which at least min_number_cases delays were recorded. We then use all the delays recorded during these weeks. Weeks are not meant as necessarily being Monday to Sunday, but simply 7 days in a row, e.g. it can be Thursday-Wednesday. Again, if less than min_number_cases delays were recorded before T, then T is ignored. We then find the minimum number of weeks, starting from the first recorded delay that contains at least min_number_cases.

Value

A vector of length at least min_number_cases, containing records of delays.

Details

An empirical_delays dataframe must contain (at least) two columns. An 'event_date' column of type Date and a 'report_delay' column of type numeric. Each row represents the recording of a single delay between event and observation. Typically, the 'event' here is the onset of symptoms of the disease of interest. And the observation can be, for instance, case confirmation, hospital admission, admission to an ICU, or death, depending on what the incidence data represents. For a particular row, 'event_date' would then represent, for a single individual, the date at which symptoms appeared. And 'report_delay' would represent the number of time steps (as specified by time_step) until the observation was made for this same individual.