This functions creates a data frame of reported cases that has been smoothed using a centred partial rolling average (with a period set by smoothing_window) and shifted back in time by some delay. It is used by estimate_infections to generate the mean shifted prior on which the back calculation method (see backcalc_opts()) is based.

create_shifted_cases(reported_cases, shift, smoothing_window, horizon)

## Arguments

reported_cases

A data frame of confirmed cases (confirm) by date (date). confirm must be integer and date must be in date format.

shift

Numeric, mean delay shift to apply.

smoothing_window

Numeric, the rolling average smoothing window to apply. Must be odd in order to be defined as a centred average.

horizon

Numeric, defaults to 7. Number of days into the future to forecast.

## Value

A data frame for shifted reported cases

## Examples

create_shifted_cases(example_confirmed, 7, 14, 7)
#>            date confirm
#>   1: 2020-03-07    3028
#>   2: 2020-03-08    3407
#>   3: 2020-03-09    3698
#>   4: 2020-03-10    3912
#>   5: 2020-03-11    4217
#>  ---
#> 112: 2020-06-26     224
#> 113: 2020-06-27     222
#> 114: 2020-06-28     219
#> 115: 2020-06-29     217
#> 116: 2020-06-30     215