Calculate delay metadata based on the supplied maximum delay and independent
of other metadata or date indexing. These data are meant to be used in
conjunction with metadata on the date of reference. Users can build
additional features this data.frame
or regenerate it using this function
in the output of enw_preprocess_data()
.
Arguments
- max_delay
Numeric defaults to 20 and needs to be greater than or equal to 1 and an integer (internally it will be coerced to one using
as.integer()
). The maximum number of days to include in the delay distribution. Computation scales non-linearly with this setting so consider what maximum makes sense for your data carefully. Note that this is zero indexed and so includes the reference date andmax_delay - 1
other days (i.e. amax_delay
of 1 corresponds with no delay).- breaks
Numeric, defaults to 4. The number of breaks to use when constructing a categorised version of numeric delays.
Value
A data.frame
of delay metadata. This includes:
delay
: The numeric delay from reference date to report.delay_cat
: The categorised delay. This may be useful for model building.delay_week
: The numeric week since the delay was reported. This again may be useful for model building.delay_tail
: A logical variable defining if the delay is in the upper 75% of the potential delays. This may be particularly useful when building models that assume a parametric distribution in order to increase the weight of the tail of the reporting distribution in a pragmatic way.
See also
Preprocessing functions
enw_add_delay()
,
enw_add_max_reported()
,
enw_add_metaobs_features()
,
enw_assign_group()
,
enw_complete_dates()
,
enw_construct_data()
,
enw_delay_filter()
,
enw_extend_date()
,
enw_filter_reference_dates()
,
enw_filter_report_dates()
,
enw_latest_data()
,
enw_metadata()
,
enw_missing_reference()
,
enw_preprocess_data()
,
enw_reporting_triangle_to_long()
,
enw_reporting_triangle()
Examples
enw_delay_metadata(20, breaks = 4)
#> delay delay_cat delay_week delay_tail
#> 1: 0 [0,5) 0 FALSE
#> 2: 1 [0,5) 0 FALSE
#> 3: 2 [0,5) 0 FALSE
#> 4: 3 [0,5) 0 FALSE
#> 5: 4 [0,5) 0 FALSE
#> 6: 5 [5,10) 0 FALSE
#> 7: 6 [5,10) 0 FALSE
#> 8: 7 [5,10) 1 FALSE
#> 9: 8 [5,10) 1 FALSE
#> 10: 9 [5,10) 1 FALSE
#> 11: 10 [10,15) 1 FALSE
#> 12: 11 [10,15) 1 FALSE
#> 13: 12 [10,15) 1 FALSE
#> 14: 13 [10,15) 1 FALSE
#> 15: 14 [10,15) 2 FALSE
#> 16: 15 [15,20) 2 TRUE
#> 17: 16 [15,20) 2 TRUE
#> 18: 17 [15,20) 2 TRUE
#> 19: 18 [15,20) 2 TRUE
#> 20: 19 [15,20) 2 TRUE