Skip to content

Add support for missing NAs in estimate_infection() model #528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jan 9, 2024
Merged
Prev Previous commit
Next Next commit
correct handling of missing data in data preprocessing:
  • Loading branch information
seabbs committed Jan 8, 2024
commit 9ad395a9c14b0c79ed2ce1c3b43eb6265ce9bb6d
9 changes: 5 additions & 4 deletions R/create.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#' Create Clean Reported Cases
#' @description `r lifecycle::badge("stable")`
#' Filters leading zeros and applies an optional threshold at which point 0 cases are replaced
#' with a moving average of observed cases. See `zero_threshold` for details.
#' Filters leading zeros and applies an optional threshold at which point
#' 0 cases are replaced with a moving average of observed cases. See
#' `zero_threshold` for details.
#'
#' @param filter_leading_zeros Logical, defaults to TRUE. Should zeros at the
#' start of the time series be filtered out.
Expand Down Expand Up @@ -436,8 +437,8 @@ create_stan_data <- function(reported_cases, seeding_time,
cases <- reported_cases[(seeding_time + 1):(.N - horizon)]
cases[, lookup := seq_len(.N)]
complete_cases <- cases[!is.na(cases$confirm)]
complete_cases <- cases$confirm
cases_time <- cases$lookup
complete_cases <- complete_cases$confirm
cases_time <- complete_cases$lookup
cases <- cases$confirm

data <- list(
Expand Down