Cleans a data frame of reported cases by replacing missing dates with 0
cases and applies an optional threshold at which point 0 cases are replaced
with a moving average of observed cases. See
zero_threshold
for details.
create_clean_reported_cases(
reported_cases,
horizon,
filter_leading_zeros = TRUE,
zero_threshold = Inf
)
A cleaned data frame of reported cases
A data frame of confirmed cases (confirm) by date (date). confirm must be integer and date must be in date format.
Numeric, defaults to 7. Number of days into the future to forecast.
Logical, defaults to TRUE. Should zeros at the start of the time series be filtered out.
Numeric defaults
to Inf. Indicates if detected zero cases are meaningful by using a threshold
number of cases based on the 7 day average. If the average is above this
threshold then the zero is replaced with the backwards looking rolling
average. If set to infinity then no changes are made.
Sam Abbott
Lloyd Chapman