This function calculates and adds the maximum observed delay for each group and reference date in the provided dataset. It first checks the validity of the observation indicator and then computes the maximum delay. If an observation indicator is provided, it further adjusts the maximum observed delay for unobserved data to be negative 1 (indicating no maximum observed).
Arguments
- new_confirm
A data.table containing the columns: "reference_date", "delay", ".group", "new_confirm", and "max_obs_delay". As produced by
enw_preprocess_data()
in thenew_confirm
output with the addition of the "max_obs_delay" column as produced byadd_max_observed_delay()
.- observation_indicator
A character string specifying the column name in
new_confirm
that indicates whether an observation is observed or not. This column should be a logical vector. If NULL (default), all observations are considered observed.
Value
A data.table with the original columns of new_confirm
and an
additional "max_obs_delay" column representing the maximum observed delay
for each group and reference date. If an observation indicator is provided,
unobserved data will have a "max_obs_delay" value of -1.
See also
Helper functions for model modules
add_pmfs()
,
convolution_matrix()
,
enw_reference_by_report()
,
enw_reps_with_complete_refs()
,
extract_obs_metadata()
,
extract_sparse_matrix()
,
latest_obs_as_matrix()
,
simulate_double_censored_pmf()