From 463734cc5f83a6597b9bd89bb4090d4b2fc06f77 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 3 Dec 2024 10:49:42 -0800 Subject: [PATCH 01/54] add lubridate --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index d3527ddf..2493ac41 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -38,6 +38,7 @@ Imports: glue, hardhat (>= 1.3.0), lifecycle, + lubridate, magrittr, recipes (>= 1.0.4), rlang (>= 1.1.0), @@ -54,7 +55,6 @@ Suggests: fs, grf, knitr, - lubridate, poissonreg, purrr, quantreg, From a64b6db68408028b0da13ac707251c4de56566d0 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 3 Dec 2024 10:50:20 -0800 Subject: [PATCH 02/54] style on short line --- R/utils-latency.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/utils-latency.R b/R/utils-latency.R index d854cb9c..af76bab1 100644 --- a/R/utils-latency.R +++ b/R/utils-latency.R @@ -479,8 +479,7 @@ compare_bake_prep_latencies <- function(object, new_data, call = caller_env()) { #' @keywords internal create_shift_grid <- function(prefix, amount, target_sign, columns, latency_table, latency_sign) { - if (!is.null(latency_table) && - latency_sign == target_sign) { + if (!is.null(latency_table) && latency_sign == target_sign) { # get the actually used latencies rel_latency <- latency_table %>% filter(col_name %in% columns) latency_adjusted <- TRUE From 3f2c1c1ec8bf24a5d18baa844331c9a5ebabe712 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 3 Dec 2024 10:50:51 -0800 Subject: [PATCH 03/54] add a hidden column to track the time_value of the outcome --- R/epi_recipe.R | 3 +++ R/step_epi_shift.R | 27 +++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/R/epi_recipe.R b/R/epi_recipe.R index 646cb1b6..e004c980 100644 --- a/R/epi_recipe.R +++ b/R/epi_recipe.R @@ -568,8 +568,11 @@ bake.epi_recipe <- function(object, new_data, ..., composition = "epi_df") { } composition <- "tibble" } + new_data$.target_time_value <- new_data$time_value new_data <- NextMethod("bake") + + new_data$.target_time_value <- NULL if (!is.null(meta)) { # Baking should have dropped epi_df-ness and metadata. Re-infer some # metadata and assume others remain the same as the object/template: diff --git a/R/step_epi_shift.R b/R/step_epi_shift.R index beda182e..f12464f6 100644 --- a/R/step_epi_shift.R +++ b/R/step_epi_shift.R @@ -66,7 +66,10 @@ step_epi_lag <- )) } arg_is_nonneg_int(lag) - arg_is_chr_scalar(prefix, id) + arg_is_chr_scalar(prefix, id, role) + if (role == "outcome" && length(lag) > 1L) { + cli_abort("Only one {.val outcome} may be created with this step.") + } recipes::add_step( recipe, @@ -111,7 +114,11 @@ step_epi_ahead <- i = "Did you perhaps pass an integer in `...` accidentally?" )) } - arg_is_chr_scalar(prefix, id) + arg_is_chr_scalar(prefix, id, role) + arg_is_nonneg_int(ahead) + if (role == "outcome" && length(ahead) > 1L) { + cli_abort("Only one {.val outcome} may be created with this step.") + } recipes::add_step( recipe, @@ -247,12 +254,24 @@ prep.step_epi_ahead <- function(x, training, info = NULL, ...) { #' @export bake.step_epi_lag <- function(object, new_data, ...) { - add_shifted_columns(new_data, object) + new_data <- add_shifted_columns(new_data, object) + if (object$role == "outcome") { + shift_val <- object$shift_grid$shift_val[1] + new_data <- new_data %>% + mutate(.target_time_value = .target_time_value + shift_val) + } + new_data } #' @export bake.step_epi_ahead <- function(object, new_data, ...) { - add_shifted_columns(new_data, object) + new_data <- add_shifted_columns(new_data, object) + if (object$role == "outcome") { + shift_val <- object$shift_grid$shift_val[1] + new_data <- new_data %>% + mutate(.target_time_value = .target_time_value + shift_val) + } + new_data } #' @export From 4af6a8a3b33b9f4e09c7719178938cb31891bf2e Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 3 Dec 2024 10:51:58 -0800 Subject: [PATCH 04/54] typo in documentation and error msg --- R/flatline_forecaster.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/flatline_forecaster.R b/R/flatline_forecaster.R index 7efda3ef..bf3d3e86 100644 --- a/R/flatline_forecaster.R +++ b/R/flatline_forecaster.R @@ -16,7 +16,7 @@ #' #' @param epi_data An [epiprocess::epi_df][epiprocess::as_epi_df] #' @param outcome A scalar character for the column name we wish to predict. -#' @param args_list A list of dditional arguments as created by the +#' @param args_list A list of additional arguments as created by the #' [flatline_args_list()] constructor function. #' #' @return A data frame of point (and optionally interval) forecasts at a single @@ -34,7 +34,7 @@ flatline_forecaster <- function( args_list = flatline_args_list()) { validate_forecaster_inputs(epi_data, outcome, "time_value") if (!inherits(args_list, c("flat_fcast", "alist"))) { - cli_abort("`args_list` was not created using `flatline_args_list().") + cli_abort("`args_list` was not created using `flatline_args_list()`.") } keys <- key_colnames(epi_data) ek <- kill_time_value(keys) From 301e65130e1acc6434e2faa0e6a300195c365690 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 3 Dec 2024 10:52:25 -0800 Subject: [PATCH 05/54] adding predictor drafted --- R/step_climate_predictor.R | 212 ++++++++++++++++++++++++ tests/testthat/test-climate_predictor.R | 62 +++++++ 2 files changed, 274 insertions(+) create mode 100644 R/step_climate_predictor.R create mode 100644 tests/testthat/test-climate_predictor.R diff --git a/R/step_climate_predictor.R b/R/step_climate_predictor.R new file mode 100644 index 00000000..003eee48 --- /dev/null +++ b/R/step_climate_predictor.R @@ -0,0 +1,212 @@ +#' Calculate a growth rate +#' +#' `step_growth_rate()` creates a *specification* of a recipe step +#' that will generate one or more new columns of derived data. +#' +#' +#' @inheritParams step_epi_lag +#' @param horizon Bandwidth for the sliding window, when `method` is +#' "rel_change" or "linear_reg". See [epiprocess::growth_rate()] for more +#' details. +#' @param method Either "rel_change" or "linear_reg", +#' indicating the method to use for the growth rate +#' calculation. These are local methods: they are run in a sliding +#' fashion over the sequence (in order to estimate derivatives and hence +#' growth rates). See [epiprocess::growth_rate()] for more details. +#' @param log_scale Should growth rates be estimated using the parameterization +#' on the log scale? See details for an explanation. Default is `FALSE`. +#' @param replace_Inf Sometimes, the growth rate calculation can result in +#' infinite values (if the denominator is zero, for example). In this case, +#' most prediction methods will fail. This argument specifies potential +#' replacement values. The default (`NA`) will likely result in these rows +#' being removed from the data. Alternatively, you could specify arbitrary +#' large values, or perhaps zero. Setting this argument to `NULL` will result +#' in no replacement. +#' @param additional_gr_args_list A list of additional arguments used by +#' [epiprocess::growth_rate()]. All `...` arguments may be passed here along +#' with `dup_rm` and `na_rm`. +#' @template step-return +#' +#' +#' @family row operation steps +#' @importFrom epiprocess growth_rate +#' @export +#' @examples +#' r <- epi_recipe(covid_case_death_rates) %>% +#' step_growth_rate(case_rate, death_rate) +#' r +#' +#' r %>% +#' prep(covid_case_death_rates) %>% +#' bake(new_data = NULL) +step_climate_predictor <- + function(recipe, + ..., + role = "predictor", + time_type = c("epiweek", "week", "month", "day"), + center_method = c("median", "mean"), + window_size = 3L, + epi_keys = NULL, + prefix = "climate_", + skip = FALSE, + id = rand_id("climate_predictor")) { + if (!is_epi_recipe(recipe)) { + cli_abort("This recipe step can only operate on an {.cls epi_recipe}.") + } + time_type <- rlang::arg_match(time_type) + center_method <- rlang::arg_match(center_method) + arg_is_chr(role) + arg_is_chr(epi_keys, allow_null = TRUE) + arg_is_nonneg_int(window_size) + arg_is_scalar(window_size) + arg_is_chr_scalar(prefix, id) + arg_is_lgl_scalar(skip) + + aggr <- switch(time_type, + epiweek = lubridate::epiweek, week = lubridate::week, + month = lubridate::month, day = lubridate::yday) + + recipes::add_step( + recipe, + step_climate_predictor_new( + terms = enquos(...), + role = role, + trained = FALSE, + time_type = time_type, + aggr = aggr, + center_method = center_method, + window_size = window_size, + epi_keys = epi_keys, + result = NULL, + prefix = prefix, + columns = NULL, + skip = skip, + id = id, + case_weights = NULL + ) + ) + } + + +step_climate_predictor_new <- + function(terms, + role, + trained, + time_type, + aggr, + center_method, + window_size, + epi_keys, + result, + prefix, + columns, + skip, + id, + case_weights) { + recipes::step( + subclass = "climate_predictor", + terms = terms, + role = role, + trained = trained, + time_type = time_type, + aggr = aggr, + center_method = center_method, + window_size = window_size, + epi_keys = epi_keys, + result = result, + prefix = prefix, + columns = columns, + skip = skip, + id = id, + case_weights = case_weights + ) + } + + + +#' @export +prep.step_climate_predictor <- function(x, training, info = NULL, ...) { + col_names <- recipes_eval_select(x$terms, training, info) + recipes::check_type(training[, col_names], types = c("double", "integer")) + wts <- recipes::get_case_weights(info, training) + were_weights_used <- recipes::are_weights_used(wts, unsupervised = TRUE) + if (isFALSE(were_weights_used)) { + wts <- rep(1, nrow(training)) + } + + modulus <- switch(x$time_type, epiweek = 7L, week = 7L, month = 12L, day = 365L) + + result <- training %>% + mutate(.idx = x$aggr(time_value), .weights = wts) %>% + select(.idx, .weights, c(col_names, x$epi_keys)) %>% + summarize(across( + all_of(col_names), + ~ roll_modular_multivec(.x, .idx, .weights, x$center_method, + x$window_size, modulus)), + .by = x$epi_keys + ) %>% + unnest(col_names) + + step_climate_predictor_new( + terms = x$terms, + role = x$role, + trained = TRUE, + time_type = x$time_type, + aggr = x$aggr, + center_method = x$center_method, + window_size = x$window_size, + epi_keys = x$epi_keys, + result = result, + prefix = x$prefix, + columns = col_names, + skip = x$skip, + id = x$id, + case_weights = were_weights_used + ) +} + + + +#' @export +bake.step_climate_predictor <- function(object, new_data, ...) { + new_data %>% + mutate(.idx = object$aggr(.target_time_value)) %>% + left_join(object$result, by = c(".idx", object$epi_keys)) %>% + select(-.idx) +} + + +#' @export +print.step_climate_predictor <- function(x, width = max(20, options()$width - 30), ...) { + print_epi_step( + x$columns, x$terms, x$trained, + title = "Calculating climate_predictor for ", + conjunction = "by", + extra_text = paste(x$time_type, "using the", x$center_method) + ) + invisible(x) +} + +roll_modular_multivec <- function(col, index, weights, center_method, + window_size, modulus) { + if (center_method == "mean") { + aggr <- function(x, w) weighted.mean(x, w, na.rm = TRUE) + } else { + aggr <- function(x, w) median(x, na.rm = TRUE) + } + tib <- tibble(col = col, weights = weights, index = index) |> + arrange(index) |> + tidyr::nest(data = c(col, weights), .by = index) + out <- double(nrow(tib)) + for (iter in seq_along(out)) { + entries <- (iter - window_size):(iter + window_size) %% modulus + entries[entries == 0] <- modulus + out[iter] <- with( + purrr::list_rbind(tib$data[entries]), + aggr(col, weights) + ) + } + tibble(index = unique(tib$index), climate_pred = out) +} + + diff --git a/tests/testthat/test-climate_predictor.R b/tests/testthat/test-climate_predictor.R new file mode 100644 index 00000000..0662e90d --- /dev/null +++ b/tests/testthat/test-climate_predictor.R @@ -0,0 +1,62 @@ +test_that("weighted_median works", { + col <- c(1, 2, 3, 3.5, 4, 1, -2, 4, 1, 0) + w <- rep(1, 10) + expect_equal(weighted_median(col, w), median(col)) + + w <- c(1, 1, 2, 2, 1, 1, 1, 6, 2, 2) + expect_equal(weighted_median(col, w), median(rep(col, times = w))) +}) + +test_that("roll_modular_multivec works", { + tib <- tibble( + col = c(1, 2, 3, 3.5, 4, 1, -2, 4, 1, 0), + indx = c(1, 1, 1, 2, 2, 3, 3, 3, 1, 1), + w = rep(1, 10) + ) + modulus <- 3L + # unweighted mean + expected_res <- tib |> + mutate(index = indx %% modulus, index = index + (index == 0) * modulus ) |> + summarise(climate_pred = weighted.mean(col, w = w), .by = index) + expect_equal( + roll_modular_multivec(tib$col, tib$indx, tib$w, "mean", 0, modulus), + expected_res + ) + w_size <- 1L + expected_res <- tibble(index = as.double(1:3), climate_pred = mean(tib$col)) + expect_equal( + roll_modular_multivec(tib$col, tib$indx, tib$w, "mean", 1L, modulus), + expected_res + ) + # weighted mean + tib$w <- c(1, 2, 3, 1, 2, 1, 1, 2, 2, 1) + expected_res <- tib |> + mutate(index = indx %% modulus, index = index + (index == 0) * modulus ) |> + summarise(climate_pred = weighted.mean(col, w = w), .by = index) + expect_equal( + roll_modular_multivec(tib$col, tib$indx, tib$w, "mean", 0, modulus), + expected_res + ) + tib$w <- c(1, 2, 3, 1, 2, 1, 1, 2, 2, 1) + expected_res <- tibble( + index = as.double(1:3), + climate_pred = weighted.mean(tib$col, tib$w) + ) + expect_equal( + roll_modular_multivec(tib$col, tib$indx, tib$w, "mean", 1L, modulus), + expected_res + ) + # median + expected_res <- tib |> + mutate(index = indx %% modulus, index = index + (index == 0) * modulus ) |> + summarise(climate_pred = median(col), .by = index) + expect_equal( + roll_modular_multivec(tib$col, tib$indx, tib$w, "median", 0, modulus), + expected_res + ) + expected_res <- tibble(index = as.double(1:3), climate_pred = median(tib$col)) + expect_equal( + roll_modular_multivec(tib$col, tib$indx, tib$w, "median", 1L, modulus), + expected_res + ) +}) From 6cb789750f31d2e3139a58a4e8a1aa87b6c736eb Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 3 Dec 2024 14:49:33 -0800 Subject: [PATCH 06/54] remove ability for `...` to be empty in adjust_latency --- R/step_adjust_latency.R | 78 ++++++++--------------------------------- R/utils-latency.R | 2 +- 2 files changed, 15 insertions(+), 65 deletions(-) diff --git a/R/step_adjust_latency.R b/R/step_adjust_latency.R index 3d9f1989..688f17d1 100644 --- a/R/step_adjust_latency.R +++ b/R/step_adjust_latency.R @@ -31,7 +31,7 @@ #' 1. `"ca"` is latent by 2 days, whereas `"ma"` is latent by 1 #' 2. if we want to use `b` as an exogenous variable, for `"ma"` it is latent by 3 days instead of just 1. #' -#' Regardless of `method`, `epi_keys_checked="geo_value"` guarantees tha the +#' Regardless of `method`, `epi_keys_checked="geo_value"` guarantees that the #' difference between `"ma"` and `"ca"` is accounted for by making the #' latency adjustment at least 2. For some comparison, here's what the various #' methods will do: @@ -47,7 +47,7 @@ #' forward to the `forecast_date`: #' ```{r toy_df} #' toy_recipe <- epi_recipe(toy_df) %>% -#' step_adjust_latency(method="locf") +#' step_adjust_latency(has_role("raw"), method="locf") #' #' toy_recipe %>% #' prep(toy_df) %>% @@ -62,9 +62,9 @@ #' latencies, the lags for each are adjusted separately. In the toy example: #' ```{r toy_df} #' toy_recipe <- epi_recipe(toy_df) %>% -#' step_adjust_latency(method="extend_lags") %>% -#' step_epi_lag(a,lag=1) %>% -#' step_epi_lag(b,lag=1) %>% +#' step_adjust_latency(has_role("raw"), method = "extend_lags") %>% +#' step_epi_lag(a, lag=1) %>% +#' step_epi_lag(b, lag=1) %>% #' step_epi_ahead(a, ahead=1) #' #' toy_recipe %>% @@ -89,8 +89,8 @@ #' the most latent data to insure there is data available. In the toy example: #' ```{r toy_df} #' toy_recipe <- epi_recipe(toy_df) %>% -#' step_adjust_latency(method="extend_ahead") %>% -#' step_epi_lag(a,lag=0) %>% +#' step_adjust_latency(has_role("raw"), method="extend_ahead") %>% +#' step_epi_lag(a, lag=0) %>% #' step_epi_ahead(a, ahead=1) #' #' toy_recipe %>% @@ -186,7 +186,7 @@ #' attributes(jhu)$metadata$as_of <- max(jhu$time_value) + 3 #' #' r <- epi_recipe(covid_case_death_rates) %>% -#' step_adjust_latency(method = "extend_ahead") %>% +#' step_adjust_latency(has_role("raw"), method = "extend_ahead") %>% #' step_epi_ahead(death_rate, ahead = 7) %>% #' step_epi_lag(death_rate, lag = c(0, 7, 14)) #' r @@ -275,20 +275,15 @@ step_adjust_latency_new <- #' @importFrom dplyr rowwise prep.step_adjust_latency <- function(x, training, info = NULL, ...) { latency <- x$latency + col_names <- recipes::recipes_eval_select(x$terms, training, info) + forecast_date <- x$fixed_forecast_date %||% get_forecast_date(training, info, x$epi_keys_checked, latency) latency_table <- get_latency_table( - training, NULL, forecast_date, latency, + training, col_names, forecast_date, latency, get_sign(x), x$epi_keys_checked, x$keys_to_ignore, info, x$terms ) - # get the columns used, even if it's all of them - terms_used <- x$terms - if (is_empty(terms_used)) { - terms_used <- info %>% - filter(role == "raw") %>% - pull(variable) - } step_adjust_latency_new( terms = x$terms, @@ -304,7 +299,7 @@ prep.step_adjust_latency <- function(x, training, info = NULL, ...) { epi_keys_checked = x$epi_keys_checked, keys_to_ignore = x$keys_to_ignore, check_latency_length = x$check_latency_length, - columns = recipes_eval_select(latency_table$col_name, training, info), + columns = col_names, skip = x$skip, id = x$id ) @@ -363,51 +358,6 @@ print.step_adjust_latency <- conj <- "with latency" extra_text <- "set at train time" } - # what follows is a somewhat modified version of print_epi_step, since the case of no arguments for adjust_latency means apply to all relevant columns, and not none of them - theme_div_id <- cli::cli_div( - theme = list(.pkg = list(`vec-trunc` = Inf, `vec-last` = ", ")) - ) - # this is a slightly modified copy of - title <- trimws(x$method) - trained_text <- dplyr::if_else(x$trained, "Trained", "") - vline_seperator <- dplyr::if_else(trained_text == "", "", "|") - comma_seperator <- dplyr::if_else( - trained_text != "", true = ",", false = "" - ) - extra_text <- recipes::format_ch_vec(extra_text) - width_title <- nchar(paste0( - "* ", title, ":", " ", conj, " ", extra_text, " ", vline_seperator, - " ", trained_text, " " - )) - width_diff <- cli::console_width() * 1 - width_title - if (x$trained) { - elements <- x$columns - } else { - if (is_empty(x$terms)) { - elements <- "all future predictors" - } else { - elements <- lapply(x$terms, function(x) { - rlang::expr_deparse(rlang::quo_get_expr(x), width = Inf) - }) - elements <- vctrs::list_unchop(elements, ptype = character()) - } - } - - element_print_lengths <- cumsum(nchar(elements)) + - c(0L, cumsum(rep(2L, length(elements) - 1))) + - c(rep(5L, length(elements) - 1), 0L) - first_line <- which(width_diff >= element_print_lengths) - first_line <- unname(first_line) - first_line <- ifelse( - test = identical(first_line, integer(0)), - yes = length(element_print_lengths), - no = max(first_line) - ) - more_dots <- ifelse(first_line == length(elements), "", ", ...") - cli::cli_bullets( - c("\n {title}: \\\n {.pkg {cli::cli_vec(elements[seq_len(first_line)])}}\\\n {more_dots} \\\n {conj} \\\n {.pkg {extra_text}} \\\n {vline_seperator} \\\n {.emph {trained_text}}") - ) - - cli::cli_end(theme_div_id) - invisible(x) + print_epi_step(x$columns, x$terms, x$trained, "Adjusting", + conjunction = conj, extra_text = extra_text) } diff --git a/R/utils-latency.R b/R/utils-latency.R index af76bab1..2a700cd9 100644 --- a/R/utils-latency.R +++ b/R/utils-latency.R @@ -315,7 +315,7 @@ get_latency_table <- function(training, columns, forecast_date, latency, } # construct the latency table latency_table <- tibble(col_name = names(training)) %>% - filter(col_name %nin% key_colnames(training)) + filter(col_name %nin% c(key_colnames(training), ".target_time_value")) if (length(columns) > 0) { latency_table <- latency_table %>% filter(col_name %in% columns) } From 426f0c7250bc2af8dff02ba9dffe6526468369cb Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 3 Dec 2024 14:50:10 -0800 Subject: [PATCH 07/54] add/remove hidden target_time_value column --- R/epi_recipe.R | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/R/epi_recipe.R b/R/epi_recipe.R index e004c980..f9cbcc81 100644 --- a/R/epi_recipe.R +++ b/R/epi_recipe.R @@ -123,7 +123,11 @@ epi_recipe.epi_df <- unique(role) ) # anything else )) - + tv_info <- var_info %>% + filter(role == "time_value") %>% + mutate(variable = ".target_time_value", role = ".target_time_value", + source = "derived") + var_info <- tibble::add_row(var_info, tv_info) ## Return final object of class `recipe` out <- list( var_info = var_info, @@ -429,7 +433,7 @@ prep.epi_recipe <- function( x, training = NULL, fresh = FALSE, verbose = FALSE, retain = TRUE, log_changes = FALSE, strings_as_factors = TRUE, ...) { if (is.null(training)) { - cli_warn(c( + cli_abort(c( "!" = "No training data was supplied to {.fn prep}.", "!" = "Unlike a {.cls recipe}, an {.cls epi_recipe} does not ", "!" = "store the full template data in the object.", @@ -437,6 +441,12 @@ prep.epi_recipe <- function( "!" = "to avoid addtional warning messages." )) } + tr_names <- names(training) + if ("time_value" %in% tr_names && !(".target_time_value" %in% tr_names)) { + training$.target_time_value <- training$time_value + } else { + cli_abort("The training data does not contain a `time_value` column.") + } training <- recipes:::check_training_set(training, x, fresh) training <- epi_check_training_set(training, x) training <- relocate(training, all_of(key_colnames(training))) @@ -568,11 +578,16 @@ bake.epi_recipe <- function(object, new_data, ..., composition = "epi_df") { } composition <- "tibble" } - new_data$.target_time_value <- new_data$time_value + tr_names <- names(new_data) + if ("time_value" %in% tr_names && !(".target_time_value" %in% tr_names)) { + new_data$.target_time_value <- new_data$time_value + } else { + cli_abort("The {.val new_data} does not contain a `time_value` column.") + } new_data <- NextMethod("bake") - new_data$.target_time_value <- NULL + new_data <- dplyr::select(new_data, -.target_time_value) if (!is.null(meta)) { # Baking should have dropped epi_df-ness and metadata. Re-infer some # metadata and assume others remain the same as the object/template: @@ -599,6 +614,7 @@ print.epi_recipe <- function(x, form_width = 30, ...) { cli::cli_h3("Inputs") tab <- table(x$var_info$role, useNA = "ifany") + tab <- tab[names(tab) != ".target_time_value"] tab <- stats::setNames(tab, names(tab)) names(tab)[is.na(names(tab))] <- "undeclared role" From fef636cc1653bef8719451c6324254bb96b0185f Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 3 Dec 2024 14:50:46 -0800 Subject: [PATCH 08/54] finish climate predictor draft --- R/step_climate_predictor.R | 82 ++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/R/step_climate_predictor.R b/R/step_climate_predictor.R index 003eee48..896eb9e2 100644 --- a/R/step_climate_predictor.R +++ b/R/step_climate_predictor.R @@ -1,45 +1,39 @@ -#' Calculate a growth rate +#' Calculate a climatological variable based on the history #' -#' `step_growth_rate()` creates a *specification* of a recipe step -#' that will generate one or more new columns of derived data. +#' `step_climate()` creates a *specification* of a recipe step +#' that will generate one or more new columns of derived data. Using this as +#' a predictor is most useful when predicting strongly seasonal data. The +#' climate timing will automatically be aligned to the outcome at bake time. #' #' -#' @inheritParams step_epi_lag -#' @param horizon Bandwidth for the sliding window, when `method` is -#' "rel_change" or "linear_reg". See [epiprocess::growth_rate()] for more -#' details. -#' @param method Either "rel_change" or "linear_reg", -#' indicating the method to use for the growth rate -#' calculation. These are local methods: they are run in a sliding -#' fashion over the sequence (in order to estimate derivatives and hence -#' growth rates). See [epiprocess::growth_rate()] for more details. -#' @param log_scale Should growth rates be estimated using the parameterization -#' on the log scale? See details for an explanation. Default is `FALSE`. -#' @param replace_Inf Sometimes, the growth rate calculation can result in -#' infinite values (if the denominator is zero, for example). In this case, -#' most prediction methods will fail. This argument specifies potential -#' replacement values. The default (`NA`) will likely result in these rows -#' being removed from the data. Alternatively, you could specify arbitrary -#' large values, or perhaps zero. Setting this argument to `NULL` will result -#' in no replacement. -#' @param additional_gr_args_list A list of additional arguments used by -#' [epiprocess::growth_rate()]. All `...` arguments may be passed here along -#' with `dup_rm` and `na_rm`. +#' @inheritParams step_growth_rate +#' @param time_type The duration over which time aggregation should be performed. +#' @param center_method The measure of center to be calculated over the time +#' window. +#' @param window_size Scalar integer. How many time units on each side should +#' be included. For example, if `window_size = 3` and `time_type = "day"`, +#' then on each day in the data, the center will be calculated using 3 days +#' before and three days after. So, in this case, it operates like a weekly +#' rolling average, centered at each day. +#' @param epi_keys Character vector or `NULL`. Any columns mentioned will be +#' grouped before performing any center calculation. So for example, given +#' state-level data, a national climate would be calculated if `NULL`, but +#' passing `epi_keys = "geo_value"` would calculate the climate separately +#' by state. #' @template step-return #' #' -#' @family row operation steps -#' @importFrom epiprocess growth_rate #' @export #' @examples #' r <- epi_recipe(covid_case_death_rates) %>% -#' step_growth_rate(case_rate, death_rate) +#' step_epi_ahead(death_rate, ahead = 7) %>% +#' step_climate(death_rate, time_type = "day") #' r #' #' r %>% #' prep(covid_case_death_rates) %>% #' bake(new_data = NULL) -step_climate_predictor <- +step_climate <- function(recipe, ..., role = "predictor", @@ -62,18 +56,18 @@ step_climate_predictor <- arg_is_chr_scalar(prefix, id) arg_is_lgl_scalar(skip) - aggr <- switch(time_type, - epiweek = lubridate::epiweek, week = lubridate::week, - month = lubridate::month, day = lubridate::yday) + time_aggr <- switch(time_type, + epiweek = lubridate::epiweek, week = lubridate::week, + month = lubridate::month, day = lubridate::yday) recipes::add_step( recipe, - step_climate_predictor_new( + step_climate_new( terms = enquos(...), role = role, trained = FALSE, time_type = time_type, - aggr = aggr, + time_aggr = time_aggr, center_method = center_method, window_size = window_size, epi_keys = epi_keys, @@ -88,12 +82,12 @@ step_climate_predictor <- } -step_climate_predictor_new <- +step_climate_new <- function(terms, role, trained, time_type, - aggr, + time_aggr, center_method, window_size, epi_keys, @@ -104,12 +98,12 @@ step_climate_predictor_new <- id, case_weights) { recipes::step( - subclass = "climate_predictor", + subclass = "climate", terms = terms, role = role, trained = trained, time_type = time_type, - aggr = aggr, + time_aggr = time_aggr, center_method = center_method, window_size = window_size, epi_keys = epi_keys, @@ -125,7 +119,7 @@ step_climate_predictor_new <- #' @export -prep.step_climate_predictor <- function(x, training, info = NULL, ...) { +prep.step_climate <- function(x, training, info = NULL, ...) { col_names <- recipes_eval_select(x$terms, training, info) recipes::check_type(training[, col_names], types = c("double", "integer")) wts <- recipes::get_case_weights(info, training) @@ -137,7 +131,7 @@ prep.step_climate_predictor <- function(x, training, info = NULL, ...) { modulus <- switch(x$time_type, epiweek = 7L, week = 7L, month = 12L, day = 365L) result <- training %>% - mutate(.idx = x$aggr(time_value), .weights = wts) %>% + mutate(.idx = x$time_aggr(time_value), .weights = wts) %>% select(.idx, .weights, c(col_names, x$epi_keys)) %>% summarize(across( all_of(col_names), @@ -147,12 +141,12 @@ prep.step_climate_predictor <- function(x, training, info = NULL, ...) { ) %>% unnest(col_names) - step_climate_predictor_new( + step_climate_new( terms = x$terms, role = x$role, trained = TRUE, time_type = x$time_type, - aggr = x$aggr, + time_aggr = x$time_aggr, center_method = x$center_method, window_size = x$window_size, epi_keys = x$epi_keys, @@ -168,16 +162,16 @@ prep.step_climate_predictor <- function(x, training, info = NULL, ...) { #' @export -bake.step_climate_predictor <- function(object, new_data, ...) { +bake.step_climate <- function(object, new_data, ...) { new_data %>% - mutate(.idx = object$aggr(.target_time_value)) %>% + mutate(.idx = object$time_aggr(.target_time_value)) %>% left_join(object$result, by = c(".idx", object$epi_keys)) %>% select(-.idx) } #' @export -print.step_climate_predictor <- function(x, width = max(20, options()$width - 30), ...) { +print.step_climate <- function(x, width = max(20, options()$width - 30), ...) { print_epi_step( x$columns, x$terms, x$trained, title = "Calculating climate_predictor for ", From 3c2c9b7c033954c279ac5d130fab4d9c154e785a Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 3 Dec 2024 14:51:11 -0800 Subject: [PATCH 09/54] redocument --- NAMESPACE | 9 +++++ man/flatline_forecaster.Rd | 2 +- man/step_adjust_latency.Rd | 16 ++++---- man/step_climate.Rd | 77 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 9 deletions(-) create mode 100644 man/step_climate.Rd diff --git a/NAMESPACE b/NAMESPACE index e7e720f1..89e5683d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -20,6 +20,7 @@ S3method(autoplot,epi_workflow) S3method(bake,check_enough_train_data) S3method(bake,epi_recipe) S3method(bake,step_adjust_latency) +S3method(bake,step_climate) S3method(bake,step_epi_ahead) S3method(bake,step_epi_lag) S3method(bake,step_epi_slide) @@ -60,6 +61,7 @@ S3method(predict,flatline) S3method(prep,check_enough_train_data) S3method(prep,epi_recipe) S3method(prep,step_adjust_latency) +S3method(prep,step_climate) S3method(prep,step_epi_ahead) S3method(prep,step_epi_lag) S3method(prep,step_epi_slide) @@ -90,6 +92,7 @@ S3method(print,layer_residual_quantiles) S3method(print,layer_threshold) S3method(print,layer_unnest) S3method(print,step_adjust_latency) +S3method(print,step_climate) S3method(print,step_epi_ahead) S3method(print,step_epi_lag) S3method(print,step_epi_slide) @@ -151,6 +154,8 @@ export(cdc_baseline_args_list) export(cdc_baseline_forecaster) export(check_enough_train_data) export(clean_f_name) +export(climate_args_list) +export(climatological_forecaster) export(default_epi_recipe_blueprint) export(detect_layer) export(dist_quantiles) @@ -199,6 +204,7 @@ export(remove_model) export(slather) export(smooth_quantile_reg) export(step_adjust_latency) +export(step_climate) export(step_epi_ahead) export(step_epi_lag) export(step_epi_naomit) @@ -273,6 +279,9 @@ importFrom(glue,glue) importFrom(hardhat,extract_recipe) importFrom(hardhat,refresh_blueprint) importFrom(hardhat,run_mold) +importFrom(lubridate,epiweek) +importFrom(lubridate,epiyear) +importFrom(lubridate,ymd) importFrom(magrittr,"%>%") importFrom(magrittr,extract2) importFrom(recipes,bake) diff --git a/man/flatline_forecaster.Rd b/man/flatline_forecaster.Rd index f70c05e0..f78e2f93 100644 --- a/man/flatline_forecaster.Rd +++ b/man/flatline_forecaster.Rd @@ -11,7 +11,7 @@ flatline_forecaster(epi_data, outcome, args_list = flatline_args_list()) \item{outcome}{A scalar character for the column name we wish to predict.} -\item{args_list}{A list of dditional arguments as created by the +\item{args_list}{A list of additional arguments as created by the \code{\link[=flatline_args_list]{flatline_args_list()}} constructor function.} } \value{ diff --git a/man/step_adjust_latency.Rd b/man/step_adjust_latency.Rd index 0078de10..1493898b 100644 --- a/man/step_adjust_latency.Rd +++ b/man/step_adjust_latency.Rd @@ -114,7 +114,7 @@ there are two issues we will need to address: \item if we want to use \code{b} as an exogenous variable, for \code{"ma"} it is latent by 3 days instead of just 1. } -Regardless of \code{method}, \code{epi_keys_checked="geo_value"} guarantees tha the +Regardless of \code{method}, \code{epi_keys_checked="geo_value"} guarantees that the difference between \code{"ma"} and \code{"ca"} is accounted for by making the latency adjustment at least 2. For some comparison, here's what the various methods will do: @@ -130,7 +130,7 @@ doesn't matter which day we're trying to predict, since it just fills forward to the \code{forecast_date}: \if{html}{\out{
}}\preformatted{toy_recipe <- epi_recipe(toy_df) \%>\% - step_adjust_latency(method="locf") + step_adjust_latency(has_role("raw"), method="locf") toy_recipe \%>\% prep(toy_df) \%>\% @@ -163,9 +163,9 @@ a per-column basis; if cases and deaths are reported at different latencies, the lags for each are adjusted separately. In the toy example: \if{html}{\out{
}}\preformatted{toy_recipe <- epi_recipe(toy_df) \%>\% - step_adjust_latency(method="extend_lags") \%>\% - step_epi_lag(a,lag=1) \%>\% - step_epi_lag(b,lag=1) \%>\% + step_adjust_latency(has_role("raw"), method = "extend_lags") \%>\% + step_epi_lag(a, lag=1) \%>\% + step_epi_lag(b, lag=1) \%>\% step_epi_ahead(a, ahead=1) toy_recipe \%>\% @@ -212,8 +212,8 @@ different data sources have different latencies; it must use the latency of the most latent data to insure there is data available. In the toy example: \if{html}{\out{
}}\preformatted{toy_recipe <- epi_recipe(toy_df) \%>\% - step_adjust_latency(method="extend_ahead") \%>\% - step_epi_lag(a,lag=0) \%>\% + step_adjust_latency(has_role("raw"), method="extend_ahead") \%>\% + step_epi_lag(a, lag=0) \%>\% step_epi_ahead(a, ahead=1) toy_recipe \%>\% @@ -283,7 +283,7 @@ jhu <- covid_case_death_rates \%>\% attributes(jhu)$metadata$as_of <- max(jhu$time_value) + 3 r <- epi_recipe(covid_case_death_rates) \%>\% - step_adjust_latency(method = "extend_ahead") \%>\% + step_adjust_latency(has_role("raw"), method = "extend_ahead") \%>\% step_epi_ahead(death_rate, ahead = 7) \%>\% step_epi_lag(death_rate, lag = c(0, 7, 14)) r diff --git a/man/step_climate.Rd b/man/step_climate.Rd new file mode 100644 index 00000000..db4f027f --- /dev/null +++ b/man/step_climate.Rd @@ -0,0 +1,77 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/step_climate_predictor.R +\name{step_climate} +\alias{step_climate} +\title{Calculate a climatological variable based on the history} +\usage{ +step_climate( + recipe, + ..., + role = "predictor", + time_type = c("epiweek", "week", "month", "day"), + center_method = c("median", "mean"), + window_size = 3L, + epi_keys = NULL, + prefix = "climate_", + skip = FALSE, + id = rand_id("climate_predictor") +) +} +\arguments{ +\item{recipe}{A recipe object. The step will be added to the +sequence of operations for this recipe.} + +\item{...}{One or more selector functions to choose variables +for this step. See \code{\link[recipes:selections]{recipes::selections()}} for more details.} + +\item{role}{For model terms created by this step, what analysis role should +they be assigned? \code{lag} is default a predictor while \code{ahead} is an outcome.} + +\item{time_type}{The duration over which time aggregation should be performed.} + +\item{center_method}{The measure of center to be calculated over the time +window.} + +\item{window_size}{Scalar integer. How many time units on each side should +be included. For example, if \code{window_size = 3} and \code{time_type = "day"}, +then on each day in the data, the center will be calculated using 3 days +before and three days after. So, in this case, it operates like a weekly +rolling average, centered at each day.} + +\item{epi_keys}{Character vector or \code{NULL}. Any columns mentioned will be +grouped before performing any center calculation. So for example, given +state-level data, a national climate would be calculated if \code{NULL}, but +passing \code{epi_keys = "geo_value"} would calculate the climate separately +by state.} + +\item{prefix}{A character string that will be prefixed to the new column.} + +\item{skip}{A logical. Should the step be skipped when the +recipe is baked by \code{\link[=bake]{bake()}}? While all operations are baked +when \code{\link[=prep]{prep()}} is run, some operations may not be able to be +conducted on new data (e.g. processing the outcome variable(s)). +Care should be taken when using \code{skip = TRUE} as it may affect +the computations for subsequent operations.} + +\item{id}{A unique identifier for the step} +} +\value{ +An updated version of \code{recipe} with the new step added to the +sequence of any existing operations. +} +\description{ +\code{step_climate()} creates a \emph{specification} of a recipe step +that will generate one or more new columns of derived data. Using this as +a predictor is most useful when predicting strongly seasonal data. The +climate timing will automatically be aligned to the outcome at bake time. +} +\examples{ +r <- epi_recipe(covid_case_death_rates) \%>\% + step_epi_ahead(death_rate, ahead = 7) \%>\% + step_climate(death_rate, time_type = "day") +r + +r \%>\% + prep(covid_case_death_rates) \%>\% + bake(new_data = NULL) +} From 031b6055863be9e5fb189eeaef890087772e4eaf Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Fri, 17 Jan 2025 10:31:26 -0800 Subject: [PATCH 10/54] update rproj --- epipredict.Rproj | 1 + 1 file changed, 1 insertion(+) diff --git a/epipredict.Rproj b/epipredict.Rproj index 69fafd4b..0c2659d8 100644 --- a/epipredict.Rproj +++ b/epipredict.Rproj @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: a71c2044-10c8-46a9-9702-f4bfc95042c8 RestoreWorkspace: No SaveWorkspace: No From c598840d1ac57eceabd66fb2fb0da728a3e6cb05 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Fri, 17 Jan 2025 10:36:23 -0800 Subject: [PATCH 11/54] drafted, needs refactor --- R/climatological_forecaster.R | 252 ++++++++++++++++++ R/epi_recipe.R | 15 +- R/step_adjust_latency.R | 13 +- ...tep_climate_predictor.R => step_climate.R} | 6 +- R/step_epi_shift.R | 3 - man/climate_args_list.Rd | 97 +++++++ man/climatological_forecaster.Rd | 37 +++ man/step_climate.Rd | 2 +- tests/testthat/_snaps/bake-method.md | 2 +- .../_snaps/climatological_baseline.md | 32 +++ tests/testthat/_snaps/step_adjust_latency.md | 15 +- tests/testthat/_snaps/step_epi_shift.new.md | 27 ++ ...est-climate_predictor.R => test-climate.R} | 9 - tests/testthat/test-climatological_baseline.R | 35 +++ tests/testthat/test-epi_recipe.R | 15 +- tests/testthat/test-layer_add_forecast_date.R | 2 +- tests/testthat/test-step_adjust_latency.R | 30 +-- 17 files changed, 531 insertions(+), 61 deletions(-) create mode 100644 R/climatological_forecaster.R rename R/{step_climate_predictor.R => step_climate.R} (96%) create mode 100644 man/climate_args_list.Rd create mode 100644 man/climatological_forecaster.Rd create mode 100644 tests/testthat/_snaps/climatological_baseline.md create mode 100644 tests/testthat/_snaps/step_epi_shift.new.md rename tests/testthat/{test-climate_predictor.R => test-climate.R} (87%) create mode 100644 tests/testthat/test-climatological_baseline.R diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R new file mode 100644 index 00000000..92f5b741 --- /dev/null +++ b/R/climatological_forecaster.R @@ -0,0 +1,252 @@ +#' Climatological forecaster +#' +#' This is another "baseline" type forecaster, but it is especially appropriate +#' for strongly seasonal diseases (e.g., influenza). The idea is to forecast +#' the "typical season" by summarizing over all available history in the +#' `epi_data`. This is analogous to a "climate" forecast rather than a "weather" +#' forecast, essentially predicting "typical January" behavior by relying on a +#' long history of such periods rather than heavily using recent data. +#' +#' The forecast is taken as the quantiles of the `outcome` in a small window +#' around the target week, computed over the entire available history. +#' +#' @inheritParams flatline_forecaster +#' @param args_list A list of additional arguments as created by the +#' [climate_args_list()] constructor function. +#' +#' @return A data frame of point and interval) forecasts at a all horizons +#' for each unique combination of `key_vars`. +#' @export +#' +#' @examples +#' +#' 1 + 1 +#' 2 + 2 +climatological_forecaster <- function( + epi_data, + outcome, + args_list = climate_args_list() +) { + if (!is_epi_df(epi_data)) { + cli_abort(c( + "`epi_data` must be an {.cls epi_df}.", + "!" = "This one is a {.cls {class(epi_data)}}." + )) + } + if (!inherits(args_list, c("climate_fcast", "alist"))) { + cli_abort("`args_list` was not created using `climate_args_list()`.") + } + arg_is_chr_scalar(outcome) + hardhat::check_column_names(epi_data, c(outcome, args_list$quantile_by_key)) + ahead <- args_list$ahead + window_size <- args_list$window_size + names(ahead) <- paste0(".ahead_", ahead) + ahead_tib <- tibble(.ahead_set = names(ahead), ahead = ahead) + forecast_date <- lubridate::ymd(args_list$forecast_date) %||% + max(epi_data$time_value) %||% + attributes(epi_data)$metadata$as_of + probs <- switch(args_list$quantile_method, + epipredict = c(.25, .5, .75), + base8 = args_list$quantile_values) + outcome <- sym(outcome) + epi_data <- filter(epi_data, !is.na(!!outcome)) + target_dates <- forecast_date + lubridate::weeks(ahead) + in_window <- map2( + target_dates, names(ahead), + ~ tibble(!!.y := date_window_mod(.x, epi_data$time_value, window_size, window_size)) + ) + + epi_data <- bind_cols(epi_data, purrr::list_cbind(in_window)) %>% + pivot_longer( + dplyr::starts_with(".ahead_"), names_to = ".ahead_set", + values_to = ".in_window" + ) %>% + filter(.in_window) %>% + select(-.in_window) %>% + left_join(ahead_tib, by = ".ahead_set") + + Quantile <- function(x) { + x <- x - median(x, na.rm = TRUE) + if (args_list$symmetrize) x <- c(x, -x) + list(unname(quantile(x, probs = probs, na.rm = TRUE, type = 8))) + } + quantiles <- group_by(epi_data, .ahead_set, ahead) %>% + summarise( + .pred_distn = dist_quantiles(Quantile(!!outcome), probs), + .by = , + .groups = "drop" + ) + + epi_data <- epi_data %>% + group_by(.ahead_set, ahead, args_list$quantile_by_key) %>% + summarise(.pred = median(!!outcome, na.rm = TRUE), .groups = "drop") %>% + left_join(quantiles, by = c(".ahead_set", "ahead")) %>% + mutate( + .pred_distn = .pred_distn + .pred, + forecast_date = ymd(forecast_date), + target_date = epiweek(forecast_date + weeks(ahead)), + .ahead_set = NULL + ) + + if (args_list$quantile_method == "epipredict") { + epi_data <- mutate( + epi_data, + .pred_distn = extrapolate_quantiles(.pred_distn, args_list$quantile_values) + ) + } + if (args_list$nonneg) { + epi_data <- mutate( + epi_data, + .pred = snap(.pred, 0, Inf), + .pred_distn = snap(.pred_distn, 0, Inf) + ) + } + structure(list( + predictions = epi_data, + metadata = list( + training = attr(epi_data, "metadata"), + forecast_created = Sys.time() + )), + class = c("climate_fcast", "canned_epipred") + ) +} + +#' Climatological forecaster argument constructor +#' +#' @inheritParams flatline_args_list +#' @param ahead Vector of integers giving the number of time steps ahead +#' (in weeks) of the forecast date for which forecasts should be produced. +#' @param time_type Character. The duration to which the forecasts correspond. +#' @param window_size Integer. The number of time points on each side of the +#' target to include in the calculation. +#' @param quantile_method One of either `"base8"` or `"epipredict"`. The first +#' case uses the quantiles of the observed history within the window, calculated +#' using `type = 8`. See `?stats::quantile` for additional information. +#' Alternatively, `"epipredict"` computes only the quartiles of the observed +#' data and interpolates (or extrapolates the remainder). Those quantiles +#' between .25 and .75 are interpolated with a cubic spline, while those +#' outside this range are extrapolated on the logistic-linear scale. This +#' produces a "parametric" quantile estimate with tails that are heavier than +#' a normal distribution. See the Examples for this comparison. +#' +#' @return A list containing updated parameter choices with class `climate_alist`. +#' @export +#' +#' @examples +#' +#' climate_args_list() +#' climate_args_list( +#' ahead = 0:10, +#' quantile_levels = c(.01, .025, 1:19 / 20, .975, .99) +#' ) +#' +#' # To visualize the quantiles produced with the `epipredict` method +#' tau <- c(.01, .025, 1:19 / 20, .975, .99) +#' sm_tau <- 5:15 / 20 # values between .25 and .75 +#' distn <- dist_quantiles(qnorm(sm_tau), sm_tau) +#' epipredict_quantiles <- extrapolate_quantiles(distn, tau) %>% +#' nested_quantiles %>% +#' purrr::pluck(1, "values") +#' +#' plot( +#' qnorm(tau), +#' epipredict_quantiles, +#' pch = 16, col = 4, ylab = "epipredict", xlab = "Normal quantiles" +#' ) +#' abline(0, 1, col = 2) +climate_args_list <- function( + ahead = 1:4, + forecast_date = NULL, + time_type = c("epiweek", "week", "month", "year", "day"), + window_size = 3L, + quantile_method = c("base8", "epipredict"), + quantile_levels = c(.1, .25, .5, .75, .9), + symmetrize = FALSE, + nonneg = TRUE, + quantile_by_key = character(0L), + ...) { + + rlang::check_dots_empty() + time_type <- arg_match(time_type) + quantile_method <- arg_match(quantile_method) + if (time_type != "epiweek") { + cli_abort("Only epiweek forecasts are currently supported.") + } + arg_is_scalar(ahead, window_size, symmetrize, nonneg) + arg_is_chr(quantile_by_key, allow_empty = TRUE) + arg_is_scalar(forecast_date, allow_null = TRUE) + arg_is_date(forecast_date, allow_null = TRUE) + arg_is_nonneg_int(ahead, window_size) + arg_is_lgl(symmetrize, nonneg) + arg_is_probabilities(quantile_levels) + + structure(enlist( + ahead, forecast_date, time_type, window_size, quantile_method, + quantile_levels, symmetrize, nonneg, quantile_by_key), + class = c("climate_fcast", "alist") + ) +} + + +#' @importFrom lubridate epiyear epiweek ymd +units_in_year <- function(years, units = c("epiweek", "week", "month", "day")) { + units <- arg_match(units) + if (units == "month") return(rep(12L, length(years))) + if (units == "day") return(c(365, 366)[lubridate::leap_year(years) + 1]) + unitf <- switch(units, epiweek = lubridate::epiweek, week = lubridate::isoweek) + mat <- outer(years, 25:31, function(x, y) paste0(x, "12", y)) + apply(mat, 1, function(x) max(unitf(lubridate::ymd(x)))) +} + +date_window_mod <- function(t0, time_value, left = 1L, right = 1L, + type = c("epiweek", "isoweek", "month", "day")) { + checkmate::assert_integerish(left, lower = 0, len = 1) + checkmate::assert_integerish(right, lower = 0, len = 1) + type <- arg_match(type) + unitf <- switch( + type, + epiweek = lubridate::epiweek, + iso = lubridate::isoweek, + month = lubridate::month, + day = lubridate::day + ) + yearf <- switch( + type, + epiweek = lubridate::epiyear, + isoweek = lubridate::isoyear, + month = lubridate::year, + day = lubridate::year + ) + cur_years <- yearf(unique(c(t0, time_value))) + ll <- vctrs::vec_recycle_common(t0 = t0, time_value = time_value) + t0 <- ll$t0 + time_value <- ll$time_value + + back_years <- cur_years - 1 + all_years <- sort(unique(c(cur_years, back_years))) + year_nunits <- units_in_year(all_years, type) + back_nunits <- year_nunits[match(yearf(time_value) - 1, all_years)] + forward_nunits <- year_nunits[match(yearf(time_value), all_years)] + + unit_diff <- unitf(t0) - unitf(time_value) + in_window <- ((unit_diff >= 0) & (unit_diff %% back_nunits <= left)) | + ((unit_diff <= 0) & (unit_diff %% forward_nunits <= right)) + + in_window +} + + +episeason <- function(time_value) { + time_value <- time_value - lubridate::dmonths(6) + paste0( + strftime(time_value, "%Y"), + "/", + strftime(time_value + lubridate::years(1), "%y") + ) +} + +season_week <- function(time_value, season_start_epiweek = 39) { + stopifnot(season_start_epiweek >= 0L, season_start_epiweek <= 53L) + time_value <- time_value - lubridate::weeks(season_start_epiweek) + lubridate::epiweek(time_value) +} diff --git a/R/epi_recipe.R b/R/epi_recipe.R index f9cbcc81..c390d2cc 100644 --- a/R/epi_recipe.R +++ b/R/epi_recipe.R @@ -123,11 +123,7 @@ epi_recipe.epi_df <- unique(role) ) # anything else )) - tv_info <- var_info %>% - filter(role == "time_value") %>% - mutate(variable = ".target_time_value", role = ".target_time_value", - source = "derived") - var_info <- tibble::add_row(var_info, tv_info) + ## Return final object of class `recipe` out <- list( var_info = var_info, @@ -433,7 +429,7 @@ prep.epi_recipe <- function( x, training = NULL, fresh = FALSE, verbose = FALSE, retain = TRUE, log_changes = FALSE, strings_as_factors = TRUE, ...) { if (is.null(training)) { - cli_abort(c( + cli_warn(c( "!" = "No training data was supplied to {.fn prep}.", "!" = "Unlike a {.cls recipe}, an {.cls epi_recipe} does not ", "!" = "store the full template data in the object.", @@ -441,12 +437,7 @@ prep.epi_recipe <- function( "!" = "to avoid addtional warning messages." )) } - tr_names <- names(training) - if ("time_value" %in% tr_names && !(".target_time_value" %in% tr_names)) { - training$.target_time_value <- training$time_value - } else { - cli_abort("The training data does not contain a `time_value` column.") - } + training <- recipes:::check_training_set(training, x, fresh) training <- epi_check_training_set(training, x) training <- relocate(training, all_of(key_colnames(training))) diff --git a/R/step_adjust_latency.R b/R/step_adjust_latency.R index 688f17d1..7ce64b30 100644 --- a/R/step_adjust_latency.R +++ b/R/step_adjust_latency.R @@ -345,19 +345,20 @@ bake.step_adjust_latency <- function(object, new_data, ...) { print.step_adjust_latency <- function(x, width = max(20, options$width - 35), ...) { if (!is.null(x$forecast_date)) { - conj <- "with forecast date" + conj <- "w/ forecast date" extra_text <- x$forecast_date } else if (!is.null(x$latency_table)) { conj <- if (nrow(x$latency) == 1) { - "with latency" + "w/ latency" } else { - "with latencies" + "w/ latencies" } extra_text <- unique(x$latency_table$latency) } else { - conj <- "with latency" - extra_text <- "set at train time" + conj <- "latency" + extra_text <- "TBD at train time" } - print_epi_step(x$columns, x$terms, x$trained, "Adjusting", + title <- trimws(paste("Adj.", x$method)) + print_epi_step(x$columns, x$terms, x$trained, title, conjunction = conj, extra_text = extra_text) } diff --git a/R/step_climate_predictor.R b/R/step_climate.R similarity index 96% rename from R/step_climate_predictor.R rename to R/step_climate.R index 896eb9e2..4b4f8ed0 100644 --- a/R/step_climate_predictor.R +++ b/R/step_climate.R @@ -43,10 +43,14 @@ step_climate <- epi_keys = NULL, prefix = "climate_", skip = FALSE, - id = rand_id("climate_predictor")) { + id = rand_id("climate")) { if (!is_epi_recipe(recipe)) { cli_abort("This recipe step can only operate on an {.cls epi_recipe}.") } + n_outcomes <- sum(recipe$var_info$role == "outcome") + if (n_outcomes > 1L) { + cli_abort("Only one {.var outcome} role can be used with this step.") + } time_type <- rlang::arg_match(time_type) center_method <- rlang::arg_match(center_method) arg_is_chr(role) diff --git a/R/step_epi_shift.R b/R/step_epi_shift.R index f12464f6..30c5f756 100644 --- a/R/step_epi_shift.R +++ b/R/step_epi_shift.R @@ -116,9 +116,6 @@ step_epi_ahead <- } arg_is_chr_scalar(prefix, id, role) arg_is_nonneg_int(ahead) - if (role == "outcome" && length(ahead) > 1L) { - cli_abort("Only one {.val outcome} may be created with this step.") - } recipes::add_step( recipe, diff --git a/man/climate_args_list.Rd b/man/climate_args_list.Rd new file mode 100644 index 00000000..325b2c34 --- /dev/null +++ b/man/climate_args_list.Rd @@ -0,0 +1,97 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/climatological_forecaster.R +\name{climate_args_list} +\alias{climate_args_list} +\title{Climatological forecaster argument constructor} +\usage{ +climate_args_list( + ahead = 1:4, + forecast_date = NULL, + time_type = c("epiweek", "week", "month", "year", "day"), + window_size = 3L, + quantile_method = c("base8", "epipredict"), + quantile_levels = c(0.1, 0.25, 0.5, 0.75, 0.9), + symmetrize = FALSE, + nonneg = TRUE, + quantile_by_key = character(0L), + ... +) +} +\arguments{ +\item{ahead}{Vector of integers giving the number of time steps ahead +(in weeks) of the forecast date for which forecasts should be produced.} + +\item{forecast_date}{Date. The date from which the forecast is occurring. +The default \code{NULL} will determine this automatically from either +\enumerate{ +\item the maximum time value for which there's data if there is no latency +adjustment (the default case), or +\item the \code{as_of} date of \code{epi_data} if \code{adjust_latency} is +non-\code{NULL}. +}} + +\item{time_type}{Character. The duration to which the forecasts correspond.} + +\item{window_size}{Integer. The number of time points on each side of the +target to include in the calculation.} + +\item{quantile_method}{One of either \code{"base8"} or \code{"epipredict"}. The first +case uses the quantiles of the observed history within the window, calculated +using \code{type = 8}. See \code{?stats::quantile} for additional information. +Alternatively, \code{"epipredict"} computes only the quartiles of the observed +data and interpolates (or extrapolates the remainder). Those quantiles +between .25 and .75 are interpolated with a cubic spline, while those +outside this range are extrapolated on the logistic-linear scale. This +produces a "parametric" quantile estimate with tails that are heavier than +a normal distribution. See the Examples for this comparison.} + +\item{quantile_levels}{Vector or \code{NULL}. A vector of probabilities to produce +prediction intervals. These are created by computing the quantiles of +training residuals. A \code{NULL} value will result in point forecasts only.} + +\item{symmetrize}{Logical. The default \code{TRUE} calculates +symmetric prediction intervals. This argument only applies when +residual quantiles are used. It is not applicable with +\code{trainer = quantile_reg()}, for example.} + +\item{nonneg}{Logical. The default \code{TRUE} enforces nonnegative predictions +by hard-thresholding at 0.} + +\item{quantile_by_key}{Character vector. Groups residuals by listed keys +before calculating residual quantiles. See the \code{by_key} argument to +\code{\link[=layer_residual_quantiles]{layer_residual_quantiles()}} for more information. The default, +\code{character(0)} performs no grouping. This argument only applies when +residual quantiles are used. It is not applicable with +\code{trainer = quantile_reg()}, for example.} + +\item{...}{Space to handle future expansions (unused).} +} +\value{ +A list containing updated parameter choices with class \code{climate_alist}. +} +\description{ +Climatological forecaster argument constructor +} +\examples{ + +climate_args_list() +climate_args_list( + ahead = 0:10, + quantile_levels = c(.01, .025, 1:19 / 20, .975, .99) +) + +# To visualize the quantiles produced with the `epipredict` method +tau <- c(.01, .025, 1:19 / 20, .975, .99) +sm_tau <- 5:15 / 20 # values between .25 and .75 +distn <- dist_quantiles(qnorm(sm_tau), sm_tau) +epipredict_quantiles <- extrapolate_quantiles(distn, tau) \%>\% + nested_quantiles \%>\% + purrr::pluck(1, "values") + +plot( + qnorm(tau), + epipredict_quantiles, + pch = 16, col = 4, ylab = "epipredict", xlab = "Normal quantiles" +) +abline(0, 1, col = 2) +} diff --git a/man/climatological_forecaster.Rd b/man/climatological_forecaster.Rd new file mode 100644 index 00000000..249c37d8 --- /dev/null +++ b/man/climatological_forecaster.Rd @@ -0,0 +1,37 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/climatological_forecaster.R +\name{climatological_forecaster} +\alias{climatological_forecaster} +\title{Climatological forecaster} +\usage{ +climatological_forecaster(epi_data, outcome, args_list = climate_args_list()) +} +\arguments{ +\item{epi_data}{An \link[epiprocess:epi_df]{epiprocess::epi_df}} + +\item{outcome}{A scalar character for the column name we wish to predict.} + +\item{args_list}{A list of additional arguments as created by the +\code{\link[=climate_args_list]{climate_args_list()}} constructor function.} +} +\value{ +A data frame of point and interval) forecasts at a all horizons +for each unique combination of \code{key_vars}. +} +\description{ +This is another "baseline" type forecaster, but it is especially appropriate +for strongly seasonal diseases (e.g., influenza). The idea is to forecast +the "typical season" by summarizing over all available history in the +\code{epi_data}. This is analogous to a "climate" forecast rather than a "weather" +forecast, essentially predicting "typical January" behavior by relying on a +long history of such periods rather than heavily using recent data. +} +\details{ +The forecast is taken as the quantiles of the \code{outcome} in a small window +around the target week, computed over the entire available history. +} +\examples{ + +1 + 1 +2 + 2 +} diff --git a/man/step_climate.Rd b/man/step_climate.Rd index db4f027f..f6a5bb79 100644 --- a/man/step_climate.Rd +++ b/man/step_climate.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/step_climate_predictor.R +% Please edit documentation in R/step_climate.R \name{step_climate} \alias{step_climate} \title{Calculate a climatological variable based on the history} diff --git a/tests/testthat/_snaps/bake-method.md b/tests/testthat/_snaps/bake-method.md index eee28cc4..252bc23e 100644 --- a/tests/testthat/_snaps/bake-method.md +++ b/tests/testthat/_snaps/bake-method.md @@ -5,5 +5,5 @@ Condition Error in `hardhat::recompose()`: ! `data` must only contain numeric columns. - i These columns aren't numeric: "geo_value" and "time_value". + i These columns aren't numeric: "geo_value", "time_value", and ".target_time_value". diff --git a/tests/testthat/_snaps/climatological_baseline.md b/tests/testthat/_snaps/climatological_baseline.md new file mode 100644 index 00000000..6270e282 --- /dev/null +++ b/tests/testthat/_snaps/climatological_baseline.md @@ -0,0 +1,32 @@ +# epiwindow function works + + Code + epiwindow(t0, time_value, 1.5) + Condition + Error in `epiwindow()`: + ! Assertion on 'left' failed: Must be of type 'integerish', but element 1 is not close to an integer. + +--- + + Code + epiwindow(t0, time_value, 1, 1.5) + Condition + Error in `epiwindow()`: + ! Assertion on 'right' failed: Must be of type 'integerish', but element 1 is not close to an integer. + +--- + + Code + epiwindow(t0, time_value, seasons = "other") + Condition + Error in `epiwindow()`: + ! `seasons` must be one of "all" or "current", not "other". + +--- + + Code + epiwindow(c(t0, t0), time_value) + Condition + Error in `epiwindow()`: + ! Can't recycle `t0` (size 2) to match `time_value` (size 4). + diff --git a/tests/testthat/_snaps/step_adjust_latency.md b/tests/testthat/_snaps/step_adjust_latency.md index 8d09248f..320c6ebb 100644 --- a/tests/testthat/_snaps/step_adjust_latency.md +++ b/tests/testthat/_snaps/step_adjust_latency.md @@ -13,7 +13,7 @@ time_value: 1 -- Operations - 1. extend_lags: case_rate with latency set at train time + 1. Adj. extend_lags: has_role("raw") latency TBD at train time 2. Lagging: death_rate by 0, 6, 11 3. Lagging: case_rate by 1, 5 4. Leading: death_rate by 7 @@ -36,10 +36,11 @@ Training data contained 200 data points and no incomplete rows. -- Operations - 1. extend_lags: case_rate with forecast date 2021-07-24 | Trained - 2. Lagging: death_rate by 0, 6, 11, (lat adj) | Trained - 3. Lagging: case_rate by 6, 10, (lat adj) | Trained - 4. Leading: death_rate by 7 | Trained + 1. Adj. extend_lags: case_rate and death_rate w/ forecast date 2021-07-24 | + 2. Trained + 3. Lagging: death_rate by 5, 11, 16, (lat adj) | Trained + 4. Lagging: case_rate by 6, 10, (lat adj) | Trained + 5. Leading: death_rate by 7 | Trained --- @@ -57,7 +58,7 @@ -- Operations 1. Lagging: death_rate by 0, 7, 14 - 2. extend_ahead: all future predictors with latency set at train time + 2. Adj. extend_ahead: has_role("raw") latency TBD at train time 3. Leading: death_rate by 7 --- @@ -79,6 +80,6 @@ -- Operations 1. Lagging: death_rate by 0, 7, 14 | Trained - 2. extend_ahead: case_rate, ... with forecast date 2022-05-31 | Trained + 2. Adj. extend_ahead: case_rate, ... w/ forecast date 2022-05-31 | Trained 3. Leading: death_rate by -158, (lat adj) | Trained diff --git a/tests/testthat/_snaps/step_epi_shift.new.md b/tests/testthat/_snaps/step_epi_shift.new.md new file mode 100644 index 00000000..f18e82e9 --- /dev/null +++ b/tests/testthat/_snaps/step_epi_shift.new.md @@ -0,0 +1,27 @@ +# Values for ahead and lag must be integer values + + Code + r1 <- epi_recipe(x) %>% step_epi_ahead(death_rate, ahead = 3.6) %>% + step_epi_lag(death_rate, lag = 1.9) + Condition + Error in `step_epi_ahead()`: + ! `ahead` must be a non-negative integer. + +# A negative lag value should should throw an error + + Code + r2 <- epi_recipe(x) %>% step_epi_ahead(death_rate, ahead = 7) %>% step_epi_lag( + death_rate, lag = -7) + Condition + Error in `step_epi_lag()`: + ! `lag` must be a non-negative integer. + +# Values for ahead and lag cannot be duplicates + + Code + slm_fit(r4) + Condition + Error in `add_shifted_columns()`: + ! Name collision occured in + The following variable name already exists: "lag_7_death_rate". + diff --git a/tests/testthat/test-climate_predictor.R b/tests/testthat/test-climate.R similarity index 87% rename from tests/testthat/test-climate_predictor.R rename to tests/testthat/test-climate.R index 0662e90d..75e6d33d 100644 --- a/tests/testthat/test-climate_predictor.R +++ b/tests/testthat/test-climate.R @@ -1,12 +1,3 @@ -test_that("weighted_median works", { - col <- c(1, 2, 3, 3.5, 4, 1, -2, 4, 1, 0) - w <- rep(1, 10) - expect_equal(weighted_median(col, w), median(col)) - - w <- c(1, 1, 2, 2, 1, 1, 1, 6, 2, 2) - expect_equal(weighted_median(col, w), median(rep(col, times = w))) -}) - test_that("roll_modular_multivec works", { tib <- tibble( col = c(1, 2, 3, 3.5, 4, 1, -2, 4, 1, 0), diff --git a/tests/testthat/test-climatological_baseline.R b/tests/testthat/test-climatological_baseline.R new file mode 100644 index 00000000..e4fa5207 --- /dev/null +++ b/tests/testthat/test-climatological_baseline.R @@ -0,0 +1,35 @@ +test_that("epiwindow function works", { + skip() + + t0 <- ymd("2024-01-08") + time_value <- ymd(c("2024-01-01", "2023-12-30", "2023-12-01", "2022-01-08")) + expect_snapshot(error = TRUE, epiwindow(t0, time_value, 1.5)) + expect_snapshot(error = TRUE, epiwindow(t0, time_value, 1, 1.5)) + expect_snapshot(error = TRUE, epiwindow(t0, time_value, seasons = "other")) + expect_snapshot(error = TRUE, epiwindow(c(t0, t0), time_value)) + + expect_identical(epiwindow(t0, time_value), c(TRUE, FALSE, FALSE, TRUE)) + time_value <- ymd(c("2024-01-01", "2023-12-31", "2023-12-01", "2022-01-08")) + expect_identical(epiwindow(t0, time_value), c(TRUE, TRUE, FALSE, TRUE)) + t0 <- ymd("20231231") + expect_identical(epiwindow(t0, time_value), c(TRUE, TRUE, FALSE, TRUE)) + expect_identical( + epiwindow(t0, time_value, seasons = "current"), + c(TRUE, TRUE, FALSE, FALSE) + ) + + # 2025 has 53 epiweeks in the year + t0 <- ymd("2026-01-08") # week 1 + # second is week 53 + time_value <- ymd(c("2026-01-01", "2025-12-27", "2025-12-01", "2022-01-08")) + expect_identical(epiwindow(t0, time_value), c(TRUE, FALSE, FALSE, TRUE)) + # second is week 52 + time_value <- ymd(c("2025-01-01", "2024-12-30", "2024-12-01", "2022-01-08")) + expect_identical(epiwindow(t0, time_value), c(TRUE, TRUE, FALSE, TRUE)) + t0 <- ymd("20251231") + expect_identical(epiwindow(t0, time_value), c(TRUE, TRUE, FALSE, TRUE)) + expect_identical( + epiwindow(t0, time_value, seasons = "current"), + c(TRUE, TRUE, FALSE, FALSE) + ) +}) diff --git a/tests/testthat/test-epi_recipe.R b/tests/testthat/test-epi_recipe.R index b4c59c0e..9f432b7f 100644 --- a/tests/testthat/test-epi_recipe.R +++ b/tests/testthat/test-epi_recipe.R @@ -23,7 +23,8 @@ test_that("epi_recipe formula works", { "x", c("integer", "numeric"), "predictor", "original", "y", c("integer", "numeric"), "outcome", "original", "time_value", "date", "time_value", "original", - "geo_value", c("string", "unordered", "nominal"), "geo_value", "original" + "geo_value", c("string", "unordered", "nominal"), "geo_value", "original", + ".target_time_value", "date", ".target_time_value", "derived" ) expect_identical(r$var_info, ref_var_info) expect_equal(nrow(r$template), 1L) @@ -52,7 +53,8 @@ test_that("epi_recipe formula works", { tibble::add_row( variable = "z", type = list(c("string", "unordered", "nominal")), role = "key", - source = "original" + source = "original", + .before = 6L ) expect_identical(r$var_info, ref_var_info) @@ -71,7 +73,8 @@ test_that("epi_recipe epi_df works", { "time_value", "date", "time_value", "original", "geo_value", c("string", "unordered", "nominal"), "geo_value", "original", "x", c("integer", "numeric"), "raw", "original", - "y", c("integer", "numeric"), "raw", "original" + "y", c("integer", "numeric"), "raw", "original", + ".target_time_value", "date", ".target_time_value", "derived" ) expect_identical(r$var_info, ref_var_info) expect_equal(nrow(r$template), 1L) @@ -82,7 +85,8 @@ test_that("epi_recipe epi_df works", { "x", c("integer", "numeric"), "predictor", "original", "y", c("integer", "numeric"), "outcome", "original", "time_value", "date", "time_value", "original", - "geo_value", c("string", "unordered", "nominal"), "geo_value", "original" + "geo_value", c("string", "unordered", "nominal"), "geo_value", "original", + ".target_time_value", "date", ".target_time_value", "derived" ) expect_identical(r$var_info, ref_var_info) expect_equal(nrow(r$template), 1L) @@ -95,7 +99,8 @@ test_that("epi_recipe epi_df works", { ref_var_info <- ref_var_info %>% tibble::add_row( variable = "time_value", type = list("date"), role = "funny_business", - source = "original" + source = "original", + .before = 5 ) expect_identical(r$var_info, ref_var_info) expect_equal(nrow(r$template), 1L) diff --git a/tests/testthat/test-layer_add_forecast_date.R b/tests/testthat/test-layer_add_forecast_date.R index 8bf452a8..3beb87dc 100644 --- a/tests/testthat/test-layer_add_forecast_date.R +++ b/tests/testthat/test-layer_add_forecast_date.R @@ -77,7 +77,7 @@ test_that("`layer_add_forecast_date()` infers correct date when using `adjust_la attributes(jhu_reasonable_date)$metadata$as_of <- as.Date("2022-01-03") r_latent <- epi_recipe(jhu_reasonable_date) %>% step_epi_lag(death_rate, lag = c(0, 7, 14)) %>% - step_adjust_latency(method = "extend_ahead") %>% + step_adjust_latency(death_rate, method = "extend_ahead") %>% step_epi_ahead(death_rate, ahead = 7) %>% step_naomit(all_predictors()) %>% step_naomit(all_outcomes(), skip = TRUE) diff --git a/tests/testthat/test-step_adjust_latency.R b/tests/testthat/test-step_adjust_latency.R index 7b1f320e..1e9127bb 100644 --- a/tests/testthat/test-step_adjust_latency.R +++ b/tests/testthat/test-step_adjust_latency.R @@ -42,10 +42,10 @@ attributes(x_lagged)$metadata$as_of <- testing_as_of test_that("epi_adjust_latency correctly extends the lags", { expect_warning(epi_recipe(x) %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% - step_adjust_latency(method = "extend_lags")) + step_adjust_latency(death_rate, method = "extend_lags")) r1 <- epi_recipe(x) %>% - step_adjust_latency(method = "extend_lags") %>% + step_adjust_latency(death_rate, case_rate, method = "extend_lags") %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% step_epi_lag(case_rate, lag = c(1, 5)) %>% step_epi_ahead(death_rate, ahead = ahead) @@ -130,7 +130,7 @@ test_that("epi_adjust_latency correctly extends the lags", { test_that("epi_adjust_latency correctly extends the ahead", { r2 <- epi_recipe(x) %>% - step_adjust_latency(method = "extend_ahead") %>% + step_adjust_latency(death_rate, method = "extend_ahead") %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% step_epi_lag(case_rate, lag = c(1, 5)) %>% step_epi_ahead(death_rate, ahead = ahead) @@ -175,7 +175,7 @@ test_that("epi_adjust_latency correctly extends the ahead", { test_that("epi_adjust_latency correctly locfs", { r1 <- epi_recipe(x) %>% - step_adjust_latency(method = "locf") %>% + step_adjust_latency(has_role("raw"), method = "locf") %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% step_epi_lag(case_rate, lag = c(1, 5)) %>% step_epi_ahead(death_rate, ahead = ahead) @@ -228,7 +228,7 @@ test_that("epi_adjust_latency correctly locfs", { test_that("epi_adjust_latency extends multiple aheads", { aheads <- 1:3 r3 <- epi_recipe(x) %>% - step_adjust_latency(method = "extend_ahead") %>% + step_adjust_latency(death_rate, method = "extend_ahead") %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% step_epi_lag(case_rate, lag = c(1, 5)) %>% step_epi_ahead(death_rate, ahead = aheads) @@ -285,7 +285,7 @@ test_that("epi_adjust_latency extends multiple aheads", { test_that("epi_adjust_latency fixed_forecast_date works", { r4 <- epi_recipe(x) %>% - step_adjust_latency(method = "extend_lags", fixed_forecast_date = max_time + 14) %>% + step_adjust_latency(has_role("raw"), method = "extend_lags", fixed_forecast_date = max_time + 14) %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% step_epi_lag(case_rate, lag = c(1, 5)) %>% step_epi_ahead(death_rate, ahead = ahead) @@ -316,7 +316,7 @@ test_that("epi_adjust_latency fixed_forecast_date works", { test_that("epi_adjust_latency fixed_latency works", { r4.1 <- epi_recipe(x) %>% - step_adjust_latency(method = "extend_lags", fixed_latency = 2) %>% + step_adjust_latency(has_role("raw"), method = "extend_lags", fixed_latency = 2) %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% step_epi_lag(case_rate, lag = c(1, 5)) %>% step_epi_ahead(death_rate, ahead = ahead) @@ -357,13 +357,13 @@ test_that("epi_adjust_latency warns there's steps before it", { expect_warning( r5 <- epi_recipe(x) %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% - step_adjust_latency(method = "extend_lags"), + step_adjust_latency(death_rate, method = "extend_lags"), regexp = "extend_lags" ) expect_warning( r5 <- epi_recipe(x) %>% step_epi_ahead(death_rate, ahead = ahead) %>% - step_adjust_latency(method = "extend_ahead"), + step_adjust_latency(death_rate, method = "extend_ahead"), regexp = "extend_ahead" ) }) @@ -375,7 +375,7 @@ test_that("epi_adjust_latency warns there's steps before it", { test_that("epi_adjust_latency correctly extends the lags when there are different delays per-geo", { r5 <- epi_recipe(x_lagged) %>% - step_adjust_latency(method = "extend_lags") %>% + step_adjust_latency(has_role("raw"), method = "extend_lags") %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% step_epi_lag(case_rate, lag = c(1, 5)) %>% step_epi_ahead(death_rate, ahead = ahead) @@ -417,7 +417,7 @@ test_that("epi_adjust_latency correctly extends the lags when there are differen test_that("epi_adjust_latency correctly extends the ahead when there are different delays per-geo", { r5 <- epi_recipe(x_lagged) %>% - step_adjust_latency(method = "extend_ahead") %>% + step_adjust_latency(death_rate, method = "extend_ahead") %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% step_epi_lag(case_rate, lag = c(1, 5)) %>% step_epi_ahead(death_rate, ahead = ahead) @@ -502,7 +502,7 @@ test_that("`step_adjust_latency` only uses the columns specified in the `...`", test_that("printing step_adjust_latency results in expected output", { r5 <- epi_recipe(x) %>% - step_adjust_latency(case_rate, method = "extend_lags") %>% + step_adjust_latency(has_role("raw"), method = "extend_lags") %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% step_epi_lag(case_rate, lag = c(1, 5)) %>% step_epi_ahead(death_rate, ahead = ahead) @@ -510,7 +510,7 @@ test_that("printing step_adjust_latency results in expected output", { expect_snapshot(prep(r5, real_x)) r6 <- epi_recipe(covid_case_death_rates) %>% step_epi_lag(death_rate, lag = c(0, 7, 14)) %>% - step_adjust_latency(method = "extend_ahead") %>% + step_adjust_latency(has_role("raw"), method = "extend_ahead") %>% step_epi_ahead(death_rate, ahead = 7) expect_snapshot(r6) expect_snapshot(prep(r6, covid_case_death_rates)) @@ -519,10 +519,10 @@ test_that("printing step_adjust_latency results in expected output", { test_that("locf works as intended", { expect_warning(epi_recipe(x) %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% - step_adjust_latency(method = "locf")) + step_adjust_latency(death_rate, method = "locf")) r6 <- epi_recipe(x) %>% - step_adjust_latency(method = "locf") %>% + step_adjust_latency(has_role("raw"), method = "locf") %>% step_epi_lag(death_rate, lag = c(0, 6, 11)) %>% step_epi_lag(case_rate, lag = c(1, 5)) %>% step_epi_ahead(death_rate, ahead = ahead) From a66d07f55033693e13953280b0fc59961757a6c3 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 4 Feb 2025 15:49:41 -0800 Subject: [PATCH 12/54] climate prep/bake steps work as planned. does not adjust for aheads --- NEWS.md | 1 + R/step_climate.R | 26 ++++++++++++++------------ R/step_epi_shift.R | 1 - R/utils-latency.R | 5 ++--- man/step_adjust_latency.Rd | 4 ++-- man/step_climate.Rd | 2 +- tests/testthat/test-climate.R | 11 +++++++++++ 7 files changed, 31 insertions(+), 19 deletions(-) diff --git a/NEWS.md b/NEWS.md index e5e1bb81..e50083fb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,6 +11,7 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.0.x will indicat `data()`, but can be accessed with `data(, package = "epidatasets")`, `epidatasets::` or, after loading the package, the name of the dataset alone (#382). +- `step_adjust_latency()` no longer allows empty column selection. ## Improvements diff --git a/R/step_climate.R b/R/step_climate.R index 4b4f8ed0..2173c7c4 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -127,23 +127,25 @@ prep.step_climate <- function(x, training, info = NULL, ...) { col_names <- recipes_eval_select(x$terms, training, info) recipes::check_type(training[, col_names], types = c("double", "integer")) wts <- recipes::get_case_weights(info, training) - were_weights_used <- recipes::are_weights_used(wts, unsupervised = TRUE) - if (isFALSE(were_weights_used)) { - wts <- rep(1, nrow(training)) - } + wts_used <- !is.null(wts) + wts <- wts %||% rep(1, nrow(training)) modulus <- switch(x$time_type, epiweek = 7L, week = 7L, month = 12L, day = 365L) result <- training %>% mutate(.idx = x$time_aggr(time_value), .weights = wts) %>% select(.idx, .weights, c(col_names, x$epi_keys)) %>% - summarize(across( - all_of(col_names), - ~ roll_modular_multivec(.x, .idx, .weights, x$center_method, - x$window_size, modulus)), - .by = x$epi_keys + tidyr::pivot_longer(all_of(unname(col_names))) %>% + dplyr::reframe( + roll_modular_multivec(value, .idx, .weights, x$center_method, + x$window_size, modulus), + .by = c("name", x$epi_keys) + ) %>% + tidyr::pivot_wider( + names_from = "name", values_from = "climate_pred", + names_prefix = x$prefix ) %>% - unnest(col_names) + rename(.idx = index) step_climate_new( terms = x$terms, @@ -159,7 +161,7 @@ prep.step_climate <- function(x, training, info = NULL, ...) { columns = col_names, skip = x$skip, id = x$id, - case_weights = were_weights_used + case_weights = wts_used ) } @@ -168,7 +170,7 @@ prep.step_climate <- function(x, training, info = NULL, ...) { #' @export bake.step_climate <- function(object, new_data, ...) { new_data %>% - mutate(.idx = object$time_aggr(.target_time_value)) %>% + mutate(.idx = object$time_aggr(time_value)) %>% left_join(object$result, by = c(".idx", object$epi_keys)) %>% select(-.idx) } diff --git a/R/step_epi_shift.R b/R/step_epi_shift.R index dfc0c2bc..ae4bd3f3 100644 --- a/R/step_epi_shift.R +++ b/R/step_epi_shift.R @@ -115,7 +115,6 @@ step_epi_ahead <- )) } arg_is_chr_scalar(prefix, id, role) - arg_is_nonneg_int(ahead) recipes::add_step( recipe, diff --git a/R/utils-latency.R b/R/utils-latency.R index f0696514..398cc907 100644 --- a/R/utils-latency.R +++ b/R/utils-latency.R @@ -315,12 +315,11 @@ get_latency_table <- function(training, columns, forecast_date, latency, } # construct the latency table latency_table <- tibble(col_name = names(training)) %>% - filter(col_name %nin% c(key_colnames(training)) + filter(col_name %nin% key_colnames(training)) if (length(columns) > 0) { latency_table <- latency_table %>% filter(col_name %in% columns) } - training_dropped <- training %>% - drop_ignored_keys(keys_to_ignore) + training_dropped <- training %>% drop_ignored_keys(keys_to_ignore) if (is.null(latency)) { latency_table <- latency_table %>% rowwise() %>% diff --git a/man/step_adjust_latency.Rd b/man/step_adjust_latency.Rd index 9761f36b..1493898b 100644 --- a/man/step_adjust_latency.Rd +++ b/man/step_adjust_latency.Rd @@ -267,8 +267,8 @@ while this will not: \if{html}{\out{
}}\preformatted{toy_recipe <- epi_recipe(toy_df) \%>\% step_epi_lag(a, lag=0) \%>\% step_adjust_latency(a, method = "extend_lags") -#> Warning: If `method` is "extend_lags" or "locf", then the previous `step_epi_lag`s won't work with -#> modified data. +#> Warning: If `method` is "extend_lags" or "locf", then the previous `step_epi_lag`s won't +#> work with modified data. }\if{html}{\out{
}} If you create columns that you then apply lags to (such as diff --git a/man/step_climate.Rd b/man/step_climate.Rd index f6a5bb79..139aa61e 100644 --- a/man/step_climate.Rd +++ b/man/step_climate.Rd @@ -14,7 +14,7 @@ step_climate( epi_keys = NULL, prefix = "climate_", skip = FALSE, - id = rand_id("climate_predictor") + id = rand_id("climate") ) } \arguments{ diff --git a/tests/testthat/test-climate.R b/tests/testthat/test-climate.R index 75e6d33d..f7d737e4 100644 --- a/tests/testthat/test-climate.R +++ b/tests/testthat/test-climate.R @@ -51,3 +51,14 @@ test_that("roll_modular_multivec works", { expected_res ) }) + +test_that("bake step creates the correct training data", { + single_yr <- seq(as.Date("2021-01-01"), as.Date("2021-12-31"), by = "1 day") + x <- tibble( + time_value = rep(single_yr, times = 2L), + geo_value = rep(c("reg1", "reg2"), each = length(single_yr)), + y = rep(dnorm(seq(-3, 3, length = length(single_yr))) * 50 + 5, times = 2L) + ) %>% + as_epi_df() + r <- epi_recipe(x) %>% step_climate(y) +}) From 10cd85ff675fe71d73e45342e31538e3aaee1d45 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 4 Feb 2025 15:54:02 -0800 Subject: [PATCH 13/54] tests pass --- tests/testthat/_snaps/bake-method.md | 4 +-- tests/testthat/_snaps/population_scaling.md | 4 +-- tests/testthat/_snaps/snapshots.md | 6 ++--- tests/testthat/_snaps/step_adjust_latency.md | 4 +-- tests/testthat/_snaps/step_epi_shift.new.md | 27 -------------------- tests/testthat/test-layer_threshold_preds.R | 2 +- 6 files changed, 10 insertions(+), 37 deletions(-) delete mode 100644 tests/testthat/_snaps/step_epi_shift.new.md diff --git a/tests/testthat/_snaps/bake-method.md b/tests/testthat/_snaps/bake-method.md index 252bc23e..0e8aeb78 100644 --- a/tests/testthat/_snaps/bake-method.md +++ b/tests/testthat/_snaps/bake-method.md @@ -3,7 +3,7 @@ Code bake(prep(r, edf), NULL, composition = "matrix") Condition - Error in `hardhat::recompose()`: + Error in `juice()`: ! `data` must only contain numeric columns. - i These columns aren't numeric: "geo_value", "time_value", and ".target_time_value". + i These columns aren't numeric: "geo_value" and "time_value". diff --git a/tests/testthat/_snaps/population_scaling.md b/tests/testthat/_snaps/population_scaling.md index 9263e8e1..99714e71 100644 --- a/tests/testthat/_snaps/population_scaling.md +++ b/tests/testthat/_snaps/population_scaling.md @@ -4,7 +4,7 @@ wf <- epi_workflow(r, parsnip::linear_reg()) %>% fit(jhu) %>% add_frosting(f) Condition Error in `hardhat::validate_column_names()`: - ! The following required columns are missing: 'a'. + ! The required column "a" is missing. --- @@ -12,5 +12,5 @@ forecast(wf) Condition Error in `hardhat::validate_column_names()`: - ! The following required columns are missing: 'nothere'. + ! The required column "nothere" is missing. diff --git a/tests/testthat/_snaps/snapshots.md b/tests/testthat/_snaps/snapshots.md index f3e7e573..9fd339de 100644 --- a/tests/testthat/_snaps/snapshots.md +++ b/tests/testthat/_snaps/snapshots.md @@ -1094,7 +1094,7 @@ Training data was an with: * Geography: state, * Time type: day, - * Using data up-to-date as of: 2022-05-31. + * Using data up-to-date as of: 2023-03-10. * With the last data available on 2021-12-31 -- Predictions ----------------------------------------------------------------- @@ -1117,7 +1117,7 @@ Training data was an with: * Geography: state, * Time type: day, - * Using data up-to-date as of: 2022-05-31. + * Using data up-to-date as of: 2023-03-10. * With the last data available on 2021-12-31 -- Predictions ----------------------------------------------------------------- @@ -1141,7 +1141,7 @@ Training data was an with: * Geography: state, * Time type: day, - * Using data up-to-date as of: 2022-05-31. + * Using data up-to-date as of: 2023-03-10. * With the last data available on 2021-12-31 -- Predictions ----------------------------------------------------------------- diff --git a/tests/testthat/_snaps/step_adjust_latency.md b/tests/testthat/_snaps/step_adjust_latency.md index 320c6ebb..139e8084 100644 --- a/tests/testthat/_snaps/step_adjust_latency.md +++ b/tests/testthat/_snaps/step_adjust_latency.md @@ -80,6 +80,6 @@ -- Operations 1. Lagging: death_rate by 0, 7, 14 | Trained - 2. Adj. extend_ahead: case_rate, ... w/ forecast date 2022-05-31 | Trained - 3. Leading: death_rate by -158, (lat adj) | Trained + 2. Adj. extend_ahead: case_rate, ... w/ forecast date 2023-03-10 | Trained + 3. Leading: death_rate by -441, (lat adj) | Trained diff --git a/tests/testthat/_snaps/step_epi_shift.new.md b/tests/testthat/_snaps/step_epi_shift.new.md deleted file mode 100644 index f18e82e9..00000000 --- a/tests/testthat/_snaps/step_epi_shift.new.md +++ /dev/null @@ -1,27 +0,0 @@ -# Values for ahead and lag must be integer values - - Code - r1 <- epi_recipe(x) %>% step_epi_ahead(death_rate, ahead = 3.6) %>% - step_epi_lag(death_rate, lag = 1.9) - Condition - Error in `step_epi_ahead()`: - ! `ahead` must be a non-negative integer. - -# A negative lag value should should throw an error - - Code - r2 <- epi_recipe(x) %>% step_epi_ahead(death_rate, ahead = 7) %>% step_epi_lag( - death_rate, lag = -7) - Condition - Error in `step_epi_lag()`: - ! `lag` must be a non-negative integer. - -# Values for ahead and lag cannot be duplicates - - Code - slm_fit(r4) - Condition - Error in `add_shifted_columns()`: - ! Name collision occured in - The following variable name already exists: "lag_7_death_rate". - diff --git a/tests/testthat/test-layer_threshold_preds.R b/tests/testthat/test-layer_threshold_preds.R index 324f60a1..f3e90c21 100644 --- a/tests/testthat/test-layer_threshold_preds.R +++ b/tests/testthat/test-layer_threshold_preds.R @@ -20,7 +20,7 @@ test_that("Default pred_lower and pred_upper work as intended", { expect_equal(ncol(p), 3L) expect_s3_class(p, "epi_df") expect_equal(nrow(p), 3L) - expect_equal(round(p$.pred, digits = 3), c(0.180, 0, 0.764)) + expect_equal(round(p$.pred, digits = 3), c(0.179, 0, 0.765)) # expect_named(p, c("time_value", "geo_value", ".pred")) expect_named(p, c("geo_value", "time_value", ".pred")) }) From cd18833fc650961e11c7a04b9b32fa8a00e36b52 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Wed, 5 Feb 2025 10:17:52 -0800 Subject: [PATCH 14/54] rename objects --- R/step_climate.R | 16 +++++++--------- tests/testthat/test-climate.R | 32 ++++++++++++++++---------------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/R/step_climate.R b/R/step_climate.R index 2173c7c4..ea61e2b6 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -142,10 +142,8 @@ prep.step_climate <- function(x, training, info = NULL, ...) { .by = c("name", x$epi_keys) ) %>% tidyr::pivot_wider( - names_from = "name", values_from = "climate_pred", - names_prefix = x$prefix - ) %>% - rename(.idx = index) + names_from = "name", values_from = "climate_pred", names_prefix = x$prefix + ) step_climate_new( terms = x$terms, @@ -187,16 +185,16 @@ print.step_climate <- function(x, width = max(20, options()$width - 30), ...) { invisible(x) } -roll_modular_multivec <- function(col, index, weights, center_method, +roll_modular_multivec <- function(col, .idx, weights, center_method, window_size, modulus) { if (center_method == "mean") { aggr <- function(x, w) weighted.mean(x, w, na.rm = TRUE) } else { aggr <- function(x, w) median(x, na.rm = TRUE) } - tib <- tibble(col = col, weights = weights, index = index) |> - arrange(index) |> - tidyr::nest(data = c(col, weights), .by = index) + tib <- tibble(col = col, weights = weights, .idx = .idx) |> + arrange(.idx) |> + tidyr::nest(data = c(col, weights), .by = .idx) out <- double(nrow(tib)) for (iter in seq_along(out)) { entries <- (iter - window_size):(iter + window_size) %% modulus @@ -206,7 +204,7 @@ roll_modular_multivec <- function(col, index, weights, center_method, aggr(col, weights) ) } - tibble(index = unique(tib$index), climate_pred = out) + tibble(.idx = unique(tib$.idx), climate_pred = out) } diff --git a/tests/testthat/test-climate.R b/tests/testthat/test-climate.R index f7d737e4..9d7b7d59 100644 --- a/tests/testthat/test-climate.R +++ b/tests/testthat/test-climate.R @@ -1,53 +1,53 @@ test_that("roll_modular_multivec works", { tib <- tibble( col = c(1, 2, 3, 3.5, 4, 1, -2, 4, 1, 0), - indx = c(1, 1, 1, 2, 2, 3, 3, 3, 1, 1), + .idx = c(1, 1, 1, 2, 2, 3, 3, 3, 1, 1), w = rep(1, 10) ) modulus <- 3L # unweighted mean expected_res <- tib |> - mutate(index = indx %% modulus, index = index + (index == 0) * modulus ) |> - summarise(climate_pred = weighted.mean(col, w = w), .by = index) + mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus ) |> + summarise(climate_pred = weighted.mean(col, w = w), .by = .idx) expect_equal( - roll_modular_multivec(tib$col, tib$indx, tib$w, "mean", 0, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, "mean", 0, modulus), expected_res ) w_size <- 1L - expected_res <- tibble(index = as.double(1:3), climate_pred = mean(tib$col)) + expected_res <- tibble(.idx = as.double(1:3), climate_pred = mean(tib$col)) expect_equal( - roll_modular_multivec(tib$col, tib$indx, tib$w, "mean", 1L, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, "mean", 1L, modulus), expected_res ) # weighted mean tib$w <- c(1, 2, 3, 1, 2, 1, 1, 2, 2, 1) expected_res <- tib |> - mutate(index = indx %% modulus, index = index + (index == 0) * modulus ) |> - summarise(climate_pred = weighted.mean(col, w = w), .by = index) + mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus ) |> + summarise(climate_pred = weighted.mean(col, w = w), .by = .idx) expect_equal( - roll_modular_multivec(tib$col, tib$indx, tib$w, "mean", 0, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, "mean", 0, modulus), expected_res ) tib$w <- c(1, 2, 3, 1, 2, 1, 1, 2, 2, 1) expected_res <- tibble( - index = as.double(1:3), + .idx = as.double(1:3), climate_pred = weighted.mean(tib$col, tib$w) ) expect_equal( - roll_modular_multivec(tib$col, tib$indx, tib$w, "mean", 1L, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, "mean", 1L, modulus), expected_res ) # median expected_res <- tib |> - mutate(index = indx %% modulus, index = index + (index == 0) * modulus ) |> - summarise(climate_pred = median(col), .by = index) + mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus ) |> + summarise(climate_pred = median(col), .by = .idx) expect_equal( - roll_modular_multivec(tib$col, tib$indx, tib$w, "median", 0, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, "median", 0, modulus), expected_res ) - expected_res <- tibble(index = as.double(1:3), climate_pred = median(tib$col)) + expected_res <- tibble(.idx = as.double(1:3), climate_pred = median(tib$col)) expect_equal( - roll_modular_multivec(tib$col, tib$indx, tib$w, "median", 1L, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, "median", 1L, modulus), expected_res ) }) From bcbda6d1d851e229c1ac23225ea2d5399bf39b02 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Wed, 5 Feb 2025 17:22:43 -0800 Subject: [PATCH 15/54] climate predictor works as desired --- R/step_climate.R | 69 ++++++++++++++++++++++++++++++----- tests/testthat/test-climate.R | 62 ++++++++++++++++++++++++++++++- 2 files changed, 119 insertions(+), 12 deletions(-) diff --git a/R/step_climate.R b/R/step_climate.R index ea61e2b6..1444a79e 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -36,6 +36,7 @@ step_climate <- function(recipe, ..., + forecast_ahead = "detect", role = "predictor", time_type = c("epiweek", "week", "month", "day"), center_method = c("median", "mean"), @@ -47,11 +48,48 @@ step_climate <- if (!is_epi_recipe(recipe)) { cli_abort("This recipe step can only operate on an {.cls epi_recipe}.") } + + ## Handle ahead autodetection, single outcome, time type n_outcomes <- sum(recipe$var_info$role == "outcome") + time_type <- rlang::arg_match(time_type) + edf_time_type <- attr(recipe$template, "metadata")$time_type + if (edf_time_type == "custom") { + cli_abort("This step only works with daily, weekly, or yearmonth data.") + } if (n_outcomes > 1L) { cli_abort("Only one {.var outcome} role can be used with this step.") } - time_type <- rlang::arg_match(time_type) + if (is.character(forecast_ahead)) { + forecast_ahead <- rlang::arg_match(forecast_ahead) + if (detect_step(recipe, "epi_ahead")) { + outcomes <- extract_argument(recipe, "step_epi_ahead", "role") == "outcome" + forecast_ahead <- extract_argument(recipe, "step_epi_ahead", "ahead")[outcomes] + if (length(forecast_ahead) != 1L) { + cli_abort(c( + "To detect the `forecast_ahead` automatically, `step_epi_ahead()` + with role = 'outcome' must be specified.", + i = "Check your recipe, or specify this argument directly in `step_climate()`." + )) + } + ttype_ord <- match(time_type, c("day", "epiweek", "week", "month")) + ttype_ord <- ttype_ord - as.integer(ttype_ord > 2) + edf_ttype_ord <- match(edf_time_type, c("day", "week", "yearmonth")) + if (ttype_ord != edf_ttype_ord) { + cli_abort(c("Automatic detection of the `forecast_ahead` is only + supported if the original data and the time type for aggregation + are in the same units.", + i = "Here, the data is in {.val {edf_time_type}} while + `time_type` is {.val {time_type}}.", + i = "This is resolved most easily by specifying `forecast_ahead`." + )) + } + } else { + forecast_ahead <- 0L + } + } + arg_is_int(forecast_ahead) + + # check other args center_method <- rlang::arg_match(center_method) arg_is_chr(role) arg_is_chr(epi_keys, allow_null = TRUE) @@ -70,12 +108,14 @@ step_climate <- terms = enquos(...), role = role, trained = FALSE, + forecast_ahead = forecast_ahead, time_type = time_type, time_aggr = time_aggr, + modulus = NULL, center_method = center_method, window_size = window_size, epi_keys = epi_keys, - result = NULL, + climate_table = NULL, prefix = prefix, columns = NULL, skip = skip, @@ -90,12 +130,14 @@ step_climate_new <- function(terms, role, trained, + forecast_ahead, time_type, time_aggr, + modulus, center_method, window_size, epi_keys, - result, + climate_table, prefix, columns, skip, @@ -106,12 +148,14 @@ step_climate_new <- terms = terms, role = role, trained = trained, + forecast_ahead = forecast_ahead, time_type = time_type, time_aggr = time_aggr, + modulus = modulus, center_method = center_method, window_size = window_size, epi_keys = epi_keys, - result = result, + climate_table = climate_table, prefix = prefix, columns = columns, skip = skip, @@ -130,9 +174,9 @@ prep.step_climate <- function(x, training, info = NULL, ...) { wts_used <- !is.null(wts) wts <- wts %||% rep(1, nrow(training)) - modulus <- switch(x$time_type, epiweek = 7L, week = 7L, month = 12L, day = 365L) + modulus <- switch(x$time_type, epiweek = 53L, week = 53L, month = 12L, day = 365L) - result <- training %>% + climate_table <- training %>% mutate(.idx = x$time_aggr(time_value), .weights = wts) %>% select(.idx, .weights, c(col_names, x$epi_keys)) %>% tidyr::pivot_longer(all_of(unname(col_names))) %>% @@ -149,12 +193,14 @@ prep.step_climate <- function(x, training, info = NULL, ...) { terms = x$terms, role = x$role, trained = TRUE, + forecast_ahead = x$forecast_ahead, time_type = x$time_type, time_aggr = x$time_aggr, + modulus = modulus, center_method = x$center_method, window_size = x$window_size, epi_keys = x$epi_keys, - result = result, + climate_table = climate_table, prefix = x$prefix, columns = col_names, skip = x$skip, @@ -167,9 +213,14 @@ prep.step_climate <- function(x, training, info = NULL, ...) { #' @export bake.step_climate <- function(object, new_data, ...) { + climate_table <- object$climate_table %>% + mutate( + .idx = (.idx - object$forecast_ahead) %% object$modulus, + .idx = dplyr::case_when(.idx == 0 ~ object$modulus, TRUE ~ .idx) + ) new_data %>% mutate(.idx = object$time_aggr(time_value)) %>% - left_join(object$result, by = c(".idx", object$epi_keys)) %>% + left_join(climate_table, by = c(".idx", object$epi_keys)) %>% select(-.idx) } @@ -206,5 +257,3 @@ roll_modular_multivec <- function(col, .idx, weights, center_method, } tibble(.idx = unique(tib$.idx), climate_pred = out) } - - diff --git a/tests/testthat/test-climate.R b/tests/testthat/test-climate.R index 9d7b7d59..c786791e 100644 --- a/tests/testthat/test-climate.R +++ b/tests/testthat/test-climate.R @@ -52,13 +52,71 @@ test_that("roll_modular_multivec works", { ) }) -test_that("bake step creates the correct training data", { +test_that("prep/bake steps create the correct training data", { single_yr <- seq(as.Date("2021-01-01"), as.Date("2021-12-31"), by = "1 day") x <- tibble( time_value = rep(single_yr, times = 2L), geo_value = rep(c("reg1", "reg2"), each = length(single_yr)), - y = rep(dnorm(seq(-3, 3, length = length(single_yr))) * 50 + 5, times = 2L) + # shift by 2 days to match the epiweeks of 2021 + y = rep(c(1, 1, rep(c(1:26, 26:2), each = 7), 1, 1, 1, 1, 1, 1), times = 2L) ) %>% as_epi_df() + # epiweeks 1, 52, and 53 are all 1, note that there are days in wk 52, 2 in wk 53 r <- epi_recipe(x) %>% step_climate(y) + p <- prep(r, x) + + expected_res <- tibble(.idx = 1:53, climate_y = c(2, 2:25, 25, 25, 25:2, 2, 2)) + expect_equal(p$steps[[1]]$climate_table, expected_res) + + b <- bake(p, new_data = NULL) + expected_bake <- x %>% + mutate(.idx = lubridate::epiweek(time_value)) %>% + left_join(expected_res, by = join_by(.idx)) %>% + select(-.idx) + expect_equal(b, expected_bake) +}) + + +test_that("leading the climate predictor works as expected", { + single_yr <- seq(as.Date("2021-01-01"), as.Date("2021-12-31"), by = "1 day") + x <- tibble( + time_value = rep(single_yr, times = 2L), + geo_value = rep(c("reg1", "reg2"), each = length(single_yr)), + # shift by 2 days to match the epiweeks of 2021 + y = rep(c(1, 1, rep(c(1:26, 26:2), each = 7), 1, 1, 1, 1, 1, 1), times = 2L) + ) %>% + as_epi_df() + # epiweeks 1, 52, and 53 are all 1, note that there are days in wk 52, 2 in wk 53 + r <- epi_recipe(x) %>% + step_epi_ahead(y, ahead = 14L) %>% + step_epi_lag(y, lag = c(0, 7L, 14L)) %>% + step_climate(y, forecast_ahead = 2L) %>% + # matches the response + step_epi_naomit() + p <- prep(r, x) + + expected_res <- tibble(.idx = 1:53, climate_y = c(2, 2:25, 25, 25, 25:2, 2, 2)) + expect_equal(p$steps[[3]]$climate_table, expected_res) + + b <- bake(p, new_data = NULL) + expect_identical(max(b$time_value), as.Date("2021-12-17")) # last date with no NAs + # expected climate predictor should be shifted forward by 2 weeks + expected_climate_pred <- x %>% + mutate( + .idx = (lubridate::epiweek(time_value) + 2) %% 53, + .idx = dplyr::case_when(.idx == 0 ~ 53, TRUE ~ .idx) + ) %>% + left_join(expected_res, by = join_by(.idx)) %>% + arrange(time_value, geo_value) %>% + filter(time_value %in% unique(b$time_value)) %>% + pull(climate_y) + expect_identical(b$climate_y, expected_climate_pred) + + # Check if our test data has the right values + td <- get_test_data(r, x) + expected_test_x <- td %>% + filter(time_value == "2021-12-31") %>% + mutate(ahead_14_y = NA_real_, lag_0_y = 1, lag_7_y = 2, lag_14_y = 3, + climate_y = 2) + expect_equal(bake(p, td), expected_test_x) }) From 2fabf45bb104e43fdf4fbb0c6330557614713368 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Wed, 5 Feb 2025 17:24:04 -0800 Subject: [PATCH 16/54] rename test --- tests/testthat/{test-climate.R => test-step_climate.R} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/testthat/{test-climate.R => test-step_climate.R} (100%) diff --git a/tests/testthat/test-climate.R b/tests/testthat/test-step_climate.R similarity index 100% rename from tests/testthat/test-climate.R rename to tests/testthat/test-step_climate.R From ced85b439cc9d1af947b389f866551b467d9fef8 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Wed, 5 Feb 2025 17:58:03 -0800 Subject: [PATCH 17/54] more detailed documentation --- R/step_climate.R | 60 +++++++++++++++++++++++++++++++++++++++--- man/step_climate.Rd | 64 +++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 116 insertions(+), 8 deletions(-) diff --git a/R/step_climate.R b/R/step_climate.R index 1444a79e..b159defa 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -1,12 +1,64 @@ #' Calculate a climatological variable based on the history #' #' `step_climate()` creates a *specification* of a recipe step -#' that will generate one or more new columns of derived data. Using this as -#' a predictor is most useful when predicting strongly seasonal data. The -#' climate timing will automatically be aligned to the outcome at bake time. +#' that will generate one or more new columns of derived data. This step +#' examines all available seasons in the training data and calculates the +#' a measure of center for the "typical" season. Think of this like with +#' the weather: to predict the temperature in January in Pittsburgh, PA, +#' I might look at all previous January's on record, average their temperatures, +#' and include that in my model. So it is important to _align_ the forecast +#' horizon with the climate. See the details for more information. +#' +#' @details +#' Construction of a climate predictor can be helpful with strongly seasonal +#' data. But its utility is greatest when the estimated "climate" is aligned +#' to the forecast horizon. +#' For example, if today is December 1, and we want +#' to make a prediction for December 15, we want to know the climate for the +#' week of December 15 to use in our model. But we also want to align the rest +#' of our training data with the climate _2 weeks after_ those dates. +#' +#' To accomplish +#' this, if we have daily data, we could use `time_type = "week"` and +#' `forecast_ahead = 2`. The climate predictor would be created by taking +#' averages over each week (with a window of a few weeks before and after, as +#' determined by `window_size`), and then aligning these with the appropriate dates +#' in the training data so that each `time_value` will "see" the typical climate 2 +#' weeks in the future. +#' +#' Alternatively, in the same scenario, we could use `time_type = "day"` and +#' `forecast_ahead = 14`. The climate predictor would be created by taking +#' averages over a small window around each _day_, and then aligning these with +#' the appropriate dates in the training data so that each `time_value` will +#' "see" the climate 14 days in the future. +#' +#' The only differences between these options is the type of averaging performed +#' over the historical data. In the first case, days in the same week will get +#' the same value of the climate predictor (because we're looking at weekly +#' windows), while in the second case, every day in the data will have the +#' average climate for the _day_ that happens 14 days in the future. +#' +#' Autodetecting the forecast horizon can only be guaranteed to work correctly +#' when the time types are the same: for example using daily data for training +#' and daily climate calculations. However, using weekly data, predicting 4 +#' weeks ahead, and setting `time_type = "month"` is perfectly reasonable. It's +#' just that the climate is calculated over _months_ (January, February, March, +#' etc.) so how to properly align this when producing a forecast for the 5th week +#' in the year is challenging. For scenarios like these, it may be best to +#' approximately match the times with `forecast_ahead = 1`, for example. #' #' #' @inheritParams step_growth_rate +#' @param forecast_ahead The forecast horizon. By default, this step will try to +#' detect whether a forecast horizon has already been specified with +#' [step_epi_ahead()]. Alternatively, one can specify an explicit +#' horizon with a scalar integer. Auto-detection is only possible +#' when the time type of the `epi_df` used to create the `epi_recipe` is the +#' same as the aggregation +#' `time_type` specified in this step (say, both daily or both weekly). If, +#' for example, daily data is used with monthly time aggregation, then +#' auto-detection is not possible (and may in fact lead to strange behaviour +#' even if `forecast_ahead` is specified with an integer). See details below. #' @param time_type The duration over which time aggregation should be performed. #' @param center_method The measure of center to be calculated over the time #' window. @@ -20,6 +72,8 @@ #' state-level data, a national climate would be calculated if `NULL`, but #' passing `epi_keys = "geo_value"` would calculate the climate separately #' by state. +#' @param role What role should be assigned for any variables created by this +#' step? "predictor" is the most likely choice. #' @template step-return #' #' diff --git a/man/step_climate.Rd b/man/step_climate.Rd index 139aa61e..da51af66 100644 --- a/man/step_climate.Rd +++ b/man/step_climate.Rd @@ -7,6 +7,7 @@ step_climate( recipe, ..., + forecast_ahead = "detect", role = "predictor", time_type = c("epiweek", "week", "month", "day"), center_method = c("median", "mean"), @@ -24,8 +25,19 @@ sequence of operations for this recipe.} \item{...}{One or more selector functions to choose variables for this step. See \code{\link[recipes:selections]{recipes::selections()}} for more details.} -\item{role}{For model terms created by this step, what analysis role should -they be assigned? \code{lag} is default a predictor while \code{ahead} is an outcome.} +\item{forecast_ahead}{The forecast horizon. By default, this step will try to +detect whether a forecast horizon has already been specified with +\code{\link[=step_epi_ahead]{step_epi_ahead()}}. Alternatively, one can specify an explicit +horizon with a scalar integer. Auto-detection is only possible +when the time type of the \code{epi_df} used to create the \code{epi_recipe} is the +same as the aggregation +\code{time_type} specified in this step (say, both daily or both weekly). If, +for example, daily data is used with monthly time aggregation, then +auto-detection is not possible (and may in fact lead to strange behaviour +even if \code{forecast_ahead} is specified with an integer). See details below.} + +\item{role}{What role should be assigned for any variables created by this +step? "predictor" is the most likely choice.} \item{time_type}{The duration over which time aggregation should be performed.} @@ -61,9 +73,51 @@ sequence of any existing operations. } \description{ \code{step_climate()} creates a \emph{specification} of a recipe step -that will generate one or more new columns of derived data. Using this as -a predictor is most useful when predicting strongly seasonal data. The -climate timing will automatically be aligned to the outcome at bake time. +that will generate one or more new columns of derived data. This step +examines all available seasons in the training data and calculates the +a measure of center for the "typical" season. Think of this like with +the weather: to predict the temperature in January in Pittsburgh, PA, +I might look at all previous January's on record, average their temperatures, +and include that in my model. So it is important to \emph{align} the forecast +horizon with the climate. See the details for more information. +} +\details{ +Construction of a climate predictor can be helpful with strongly seasonal +data. But its utility is greatest when the estimated "climate" is aligned +to the forecast horizon. +For example, if today is December 1, and we want +to make a prediction for December 15, we want to know the climate for the +week of December 15 to use in our model. But we also want to align the rest +of our training data with the climate \emph{2 weeks after} those dates. + +To accomplish +this, if we have daily data, we could use \code{time_type = "week"} and +\code{forecast_ahead = 2}. The climate predictor would be created by taking +averages over each week (with a window of a few weeks before and after, as +determined by \code{window_size}), and then aligning these with the appropriate dates +in the training data so that each \code{time_value} will "see" the typical climate 2 +weeks in the future. + +Alternatively, in the same scenario, we could use \code{time_type = "day"} and +\code{forecast_ahead = 14}. The climate predictor would be created by taking +averages over a small window around each \emph{day}, and then aligning these with +the appropriate dates in the training data so that each \code{time_value} will +"see" the climate 14 days in the future. + +The only differences between these options is the type of averaging performed +over the historical data. In the first case, days in the same week will get +the same value of the climate predictor (because we're looking at weekly +windows), while in the second case, every day in the data will have the +average climate for the \emph{day} that happens 14 days in the future. + +Autodetecting the forecast horizon can only be guaranteed to work correctly +when the time types are the same: for example using daily data for training +and daily climate calculations. However, using weekly data, predicting 4 +weeks ahead, and setting \code{time_type = "month"} is perfectly reasonable. It's +just that the climate is calculated over \emph{months} (January, February, March, +etc.) so how to properly align this when producing a forecast for the 5th week +in the year is challenging. For scenarios like these, it may be best to +approximately match the times with \code{forecast_ahead = 1}, for example. } \examples{ r <- epi_recipe(covid_case_death_rates) \%>\% From 01182d7a0383eb35e41f3bcd8dece59a5b304ab1 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Wed, 5 Feb 2025 18:00:29 -0800 Subject: [PATCH 18/54] add another example --- R/step_climate.R | 12 ++++++++++++ man/step_climate.Rd | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/R/step_climate.R b/R/step_climate.R index b159defa..cbeea504 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -79,6 +79,7 @@ #' #' @export #' @examples +#' # automatically detects the horizon #' r <- epi_recipe(covid_case_death_rates) %>% #' step_epi_ahead(death_rate, ahead = 7) %>% #' step_climate(death_rate, time_type = "day") @@ -87,6 +88,17 @@ #' r %>% #' prep(covid_case_death_rates) %>% #' bake(new_data = NULL) +#' +#' # same idea, but using weekly climate +#' r <- epi_recipe(covid_case_death_rates) %>% +#' step_epi_ahead(death_rate, ahead = 7) %>% +#' step_climate(death_rate, forecast_ahead = 1, time_type = "epiweek", +#' window_size = 1L) +#' r +#' +#' r %>% +#' prep(covid_case_death_rates) %>% +#' bake(new_data = NULL) step_climate <- function(recipe, ..., diff --git a/man/step_climate.Rd b/man/step_climate.Rd index da51af66..0a8bb57d 100644 --- a/man/step_climate.Rd +++ b/man/step_climate.Rd @@ -120,11 +120,23 @@ in the year is challenging. For scenarios like these, it may be best to approximately match the times with \code{forecast_ahead = 1}, for example. } \examples{ +# automatically detects the horizon r <- epi_recipe(covid_case_death_rates) \%>\% step_epi_ahead(death_rate, ahead = 7) \%>\% step_climate(death_rate, time_type = "day") r +r \%>\% + prep(covid_case_death_rates) \%>\% + bake(new_data = NULL) + +# same idea, but using weekly climate +r <- epi_recipe(covid_case_death_rates) \%>\% + step_epi_ahead(death_rate, ahead = 7) \%>\% + step_climate(death_rate, forecast_ahead = 1, time_type = "epiweek", + window_size = 1L) +r + r \%>\% prep(covid_case_death_rates) \%>\% bake(new_data = NULL) From 83a6ec8158a2d44d8befd1deabb73f8229c49ccb Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Fri, 7 Feb 2025 13:44:11 -0800 Subject: [PATCH 19/54] use all_of in tidyselect --- R/step_climate.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/step_climate.R b/R/step_climate.R index cbeea504..cf3f2cc2 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -244,7 +244,7 @@ prep.step_climate <- function(x, training, info = NULL, ...) { climate_table <- training %>% mutate(.idx = x$time_aggr(time_value), .weights = wts) %>% - select(.idx, .weights, c(col_names, x$epi_keys)) %>% + select(.idx, .weights, all_of(c(col_names, x$epi_keys))) %>% tidyr::pivot_longer(all_of(unname(col_names))) %>% dplyr::reframe( roll_modular_multivec(value, .idx, .weights, x$center_method, From 3d3c2b40d36e0d2999e4eb7bcecc00f947ecf11a Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Fri, 7 Feb 2025 16:38:26 -0800 Subject: [PATCH 20/54] simplify docs, quantiles --- R/climatological_forecaster.R | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index 92f5b741..b5d3aedc 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -8,7 +8,7 @@ #' long history of such periods rather than heavily using recent data. #' #' The forecast is taken as the quantiles of the `outcome` in a small window -#' around the target week, computed over the entire available history. +#' around the target period, computed over the entire available history. #' #' @inheritParams flatline_forecaster #' @param args_list A list of additional arguments as created by the @@ -116,7 +116,9 @@ climatological_forecaster <- function( #' @inheritParams flatline_args_list #' @param ahead Vector of integers giving the number of time steps ahead #' (in weeks) of the forecast date for which forecasts should be produced. -#' @param time_type Character. The duration to which the forecasts correspond. +#' @param time_type The duration over which time aggregation should be performed. +#' @param center_method The measure of center to be calculated over the time +#' window. #' @param window_size Integer. The number of time points on each side of the #' target to include in the calculation. #' @param quantile_method One of either `"base8"` or `"epipredict"`. The first @@ -157,10 +159,10 @@ climatological_forecaster <- function( climate_args_list <- function( ahead = 1:4, forecast_date = NULL, - time_type = c("epiweek", "week", "month", "year", "day"), + time_type = c("epiweek", "week", "month", "day"), window_size = 3L, quantile_method = c("base8", "epipredict"), - quantile_levels = c(.1, .25, .5, .75, .9), + quantile_levels = c(.05, .1, .25, .5, .75, .9, .95), symmetrize = FALSE, nonneg = TRUE, quantile_by_key = character(0L), From dab8d43dfe6e608faba10d0d7c82c88b39147b2d Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Mon, 10 Feb 2025 11:45:23 -0800 Subject: [PATCH 21/54] merge dev epi_recipe --- R/epi_recipe.R | 187 ++++++++++++++++++++++++++----------------------- 1 file changed, 98 insertions(+), 89 deletions(-) diff --git a/R/epi_recipe.R b/R/epi_recipe.R index acbbe37d..c82ac167 100644 --- a/R/epi_recipe.R +++ b/R/epi_recipe.R @@ -13,14 +13,6 @@ epi_recipe <- function(x, ...) { } -#' @rdname epi_recipe -#' @export -epi_recipe.default <- function(x, ...) { - cli_abort(paste( - "`x` must be an {.cls epi_df} or a {.cls formula},", - "not a {.cls {class(x)[[1]]}}." - )) -} #' @rdname epi_recipe #' @inheritParams recipes::recipe @@ -28,6 +20,19 @@ epi_recipe.default <- function(x, ...) { #' describes a single role that the variable will take. This value could be #' anything but common roles are `"outcome"`, `"predictor"`, #' `"time_value"`, and `"geo_value"` +#' @param reference_date Either a date of the same class as the `time_value` +#' column in the `epi_df` or `NULL`. If a date, it gives the date to which all +#' operations are relative. Typically, in real-time tasks this is the date that +#' the model is created (and presumably trained). In forecasting, this is +#' often the same as the most recent date of +#' data availability, but when data is "latent" (reported after the date to +#' which it corresponds), or if performing a nowcast, the `reference_date` may +#' be later than this. Setting `reference_date` +#' to a value BEFORE the most recent data is not a true "forecast", +#' because future data is being used to create the model, but this may be +#' reasonable in model building, nowcasting (predicting finalized values from +#' preliminary data), or if producing a backcast. If `NULL`, it will be set +#' to the `as_of` date of the `epi_df`. #' @param ... Further arguments passed to or from other methods (not currently #' used). #' @param formula A model formula. No in-line functions should be used here @@ -35,8 +40,7 @@ epi_recipe.default <- function(x, ...) { #' transformations should be enacted using `step` functions in this package. #' Dots are allowed as are simple multivariate outcome terms (i.e. no need for #' `cbind`; see Examples). -#' @param x,data A data frame, tibble, or epi_df of the *template* data set -#' (see below). This is always coerced to the first row to avoid memory issues +#' @param x,data An epi_df of the *template* data set (see below). #' @inherit recipes::recipe return #' #' @export @@ -56,100 +60,107 @@ epi_recipe.default <- function(x, ...) { #' step_naomit(all_outcomes(), skip = TRUE) #' #' r -epi_recipe.epi_df <- - function(x, formula = NULL, ..., vars = NULL, roles = NULL) { - attr(x, "decay_to_tibble") <- FALSE - if (!is.null(formula)) { - if (!is.null(vars)) { - cli_abort(paste0( - "This `vars` specification will be ignored ", +epi_recipe.epi_df <- function(x, + reference_date = NULL, + formula = NULL, + ..., + vars = NULL, + roles = NULL) { + attr(x, "decay_to_tibble") <- FALSE + if (!is.null(formula)) { + if (!is.null(vars)) { + cli_abort(paste0( + "This `vars` specification will be ignored ", + "when a formula is used" + )) + } + if (!is.null(roles)) { + cli_abort( + paste0( + "This `roles` specification will be ignored ", "when a formula is used" - )) - } - if (!is.null(roles)) { - cli_abort( - paste0( - "This `roles` specification will be ignored ", - "when a formula is used" - ) ) - } - - obj <- epi_recipe.formula(formula, x, ...) - return(obj) - } - if (is.null(vars)) vars <- colnames(x) - if (any(table(vars) > 1)) { - cli_abort("`vars` should have unique members") - } - if (any(!(vars %in% colnames(x)))) { - cli_abort("1 or more elements of `vars` are not in the data") + ) } - keys <- key_colnames(x) # we know x is an epi_df + obj <- epi_recipe.formula(formula, x, ...) + return(obj) + } + if (is.null(vars)) vars <- colnames(x) + if (any(table(vars) > 1)) { + cli_abort("`vars` should have unique members") + } + if (any(!(vars %in% colnames(x)))) { + cli_abort("1 or more elements of `vars` are not in the data") + } - var_info <- tibble(variable = vars) - key_roles <- c("geo_value", rep("key", length(keys) - 2), "time_value") + keys <- key_colnames(x) # we know x is an epi_df - ## Check and add roles when available - if (!is.null(roles)) { - if (length(roles) != length(vars)) { - cli_abort(paste0( - "The number of roles should be the same as the number of ", - "variables." - )) - } - var_info$role <- roles - } else { - var_info <- var_info %>% filter(!(variable %in% keys)) - var_info$role <- "raw" - } - ## Now we add the keys when necessary - var_info <- dplyr::union( - var_info, - tibble::tibble(variable = keys, role = key_roles) - ) + var_info <- tibble(variable = vars) + key_roles <- c("geo_value", rep("key", length(keys) - 2), "time_value") - ## Add types - var_info <- full_join(recipes:::get_types(x), var_info, by = "variable") - var_info$source <- "original" - - ## arrange to easy order - var_info <- var_info %>% - arrange(factor( - role, - levels = union( - c("predictor", "outcome", "time_value", "geo_value", "key"), - unique(role) - ) # anything else + ## Check and add roles when available + if (!is.null(roles)) { + if (length(roles) != length(vars)) { + cli_abort(paste0( + "The number of roles should be the same as the number of ", + "variables." )) - - ## Return final object of class `recipe` - out <- list( - var_info = var_info, - term_info = var_info, - steps = NULL, - template = x[1, ], - max_time_value = max(x$time_value), - levels = NULL, - retained = NA - ) - class(out) <- c("epi_recipe", "recipe") - out + } + var_info$role <- roles + } else { + var_info <- var_info %>% filter(!(variable %in% keys)) + var_info$role <- "raw" } + ## Now we add the keys when necessary + var_info <- dplyr::union( + var_info, + tibble::tibble(variable = keys, role = key_roles) + ) + + ## Add types + var_info <- full_join(recipes:::get_types(x), var_info, by = "variable") + var_info$source <- "original" + + ## arrange to easy order + var_info <- var_info %>% + arrange(factor( + role, + levels = union( + c("predictor", "outcome", "time_value", "geo_value", "key"), + unique(role) + ) # anything else + )) + + ## Return final object of class `recipe` + max_time_value <- max(x$time_value) + reference_date <- reference_date %||% attr(x, "metadata")$as_of + out <- list( + var_info = var_info, + term_info = var_info, + steps = NULL, + template = x[1, ], + max_time_value = max_time_value, + reference_date = reference_date, + levels = NULL, + retained = NA + ) + class(out) <- c("epi_recipe", "recipe") + out +} #' @rdname epi_recipe #' @export -epi_recipe.formula <- function(formula, data, ...) { +epi_recipe.formula <- function(formula, data, reference_date = NULL, ...) { # we ensure that there's only 1 row in the template data <- data[1, ] # check for minus: if (!epiprocess::is_epi_df(data)) { - cli_abort(paste( - "`epi_recipe()` has been called with a non-{.cls epi_df} object.", - "Use `recipe()` instead." - )) + cli_abort( + "`epi_recipe()` has been called with a non-{.cls epi_df} object. + Use `recipe()` instead." + ) } attr(data, "decay_to_tibble") <- FALSE @@ -437,7 +448,6 @@ prep.epi_recipe <- function( "!" = "to avoid addtional warning messages." )) } - training <- recipes:::check_training_set(training, x, fresh) training <- epi_check_training_set(training, x) training <- relocate(training, all_of(key_colnames(training))) @@ -571,7 +581,6 @@ bake.epi_recipe <- function(object, new_data, ..., composition = "epi_df") { } new_data <- NextMethod("bake") - if (!is.null(meta)) { # Baking should have dropped epi_df-ness and metadata. Re-infer some # metadata and assume others remain the same as the object/template: From d6725a88a3c3b034047eb5152136f00a75a8b3f8 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Mon, 10 Feb 2025 14:33:58 -0800 Subject: [PATCH 22/54] refactor the forecaster --- NAMESPACE | 1 - R/arx_forecaster.R | 3 +- R/climatological_forecaster.R | 194 +++++++++++++++---------------- R/step_climate.R | 17 ++- man/arx_args_list.Rd | 3 + man/arx_fcast_epi_workflow.Rd | 2 +- man/climate_args_list.Rd | 58 ++++----- man/climatological_forecaster.Rd | 9 +- man/epi_recipe.Rd | 30 ++++- 9 files changed, 159 insertions(+), 158 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 89e5683d..2723e1f0 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -30,7 +30,6 @@ S3method(bake,step_population_scaling) S3method(bake,step_training_window) S3method(detect_layer,frosting) S3method(detect_layer,workflow) -S3method(epi_recipe,default) S3method(epi_recipe,epi_df) S3method(epi_recipe,formula) S3method(extract_argument,epi_workflow) diff --git a/R/arx_forecaster.R b/R/arx_forecaster.R index 5397ca88..6d95839a 100644 --- a/R/arx_forecaster.R +++ b/R/arx_forecaster.R @@ -92,7 +92,7 @@ arx_forecaster <- function( #' #' @return An unfitted `epi_workflow`. #' @export -#' @seealso [arx_forecaster()] +#' @seealso [arx_forecaster()], [arx_args_list()] #' #' @examples #' library(dplyr) @@ -283,6 +283,7 @@ arx_fcast_epi_workflow <- function( #' #' @return A list containing updated parameter choices with class `arx_flist`. #' @export +#' @seealso [arx_forecaster()] #' #' @examples #' arx_args_list() diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index b5d3aedc..a5cfb7bd 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -1,7 +1,7 @@ #' Climatological forecaster #' #' This is another "baseline" type forecaster, but it is especially appropriate -#' for strongly seasonal diseases (e.g., influenza). The idea is to forecast +#' for strongly seasonal diseases (e.g., influenza). The idea is to predict #' the "typical season" by summarizing over all available history in the #' `epi_data`. This is analogous to a "climate" forecast rather than a "weather" #' forecast, essentially predicting "typical January" behavior by relying on a @@ -17,92 +17,110 @@ #' @return A data frame of point and interval) forecasts at a all horizons #' for each unique combination of `key_vars`. #' @export +#' @seealso [step_climate()] #' #' @examples #' #' 1 + 1 #' 2 + 2 -climatological_forecaster <- function( - epi_data, - outcome, - args_list = climate_args_list() -) { +climatological_forecaster <- function(epi_data, + outcome, + args_list = climate_args_list()) { if (!is_epi_df(epi_data)) { - cli_abort(c( - "`epi_data` must be an {.cls epi_df}.", - "!" = "This one is a {.cls {class(epi_data)}}." - )) + cli_abort( + "`epi_data` must be an {.cls epi_df}, not a {.cls {class(epi_data)}}." + ) + } + edf_time_type <- attr(epi_data, "metadata")$time_type + if (edf_time_type == "custom") { + cli_abort("This forecaster only works with daily, weekly, or yearmonth data.") } if (!inherits(args_list, c("climate_fcast", "alist"))) { cli_abort("`args_list` was not created using `climate_args_list()`.") } arg_is_chr_scalar(outcome) hardhat::check_column_names(epi_data, c(outcome, args_list$quantile_by_key)) - ahead <- args_list$ahead + forecast_date <- args_list$forecast_date %||% attr(epi_data, "metadata")$as_of + horizon <- args_list$forecast_horizon window_size <- args_list$window_size - names(ahead) <- paste0(".ahead_", ahead) - ahead_tib <- tibble(.ahead_set = names(ahead), ahead = ahead) - forecast_date <- lubridate::ymd(args_list$forecast_date) %||% - max(epi_data$time_value) %||% - attributes(epi_data)$metadata$as_of - probs <- switch(args_list$quantile_method, - epipredict = c(.25, .5, .75), - base8 = args_list$quantile_values) - outcome <- sym(outcome) + time_type <- args_list$time_type + ttype_ord <- match(time_type, c("day", "epiweek", "week", "month")) + ttype_ord <- ttype_ord - as.integer(ttype_ord > 2) + edf_ttype_ord <- match(edf_time_type, c("day", "week", "yearmonth")) + if (ttype_ord < edf_ttype_ord) { + cli_abort(c("Climate forecasts for more granular time types are not possible + if the `epi_data` has a higher level of aggregation", + i = "Here, the data is in {.val {edf_time_type}}s while + `time_type` is {.val {time_type}}." + )) + } + # process the time types epi_data <- filter(epi_data, !is.na(!!outcome)) - target_dates <- forecast_date + lubridate::weeks(ahead) - in_window <- map2( - target_dates, names(ahead), - ~ tibble(!!.y := date_window_mod(.x, epi_data$time_value, window_size, window_size)) - ) - - epi_data <- bind_cols(epi_data, purrr::list_cbind(in_window)) %>% - pivot_longer( - dplyr::starts_with(".ahead_"), names_to = ".ahead_set", - values_to = ".in_window" + ttype_dur <- switch(time_type, + epiweek = lubridate::weeks, week = lubridate::weeks, + month = lubridate::months, day = lubridate::days) + time_aggr <- switch(time_type, + epiweek = lubridate::epiweek, week = lubridate::week, + month = lubridate::month, day = lubridate::yday) + modulus <- switch(time_type, epiweek = 53L, week = 53L, month = 12L, day = 365L) + center_fn <- switch(args_list$center_method, + mean = function(x, w) mean(x, na.rm = TRUE), + median = function(x, w) stats::median(x, na.rm = TRUE)) + # get the point predictions + outcome <- sym(outcome) + keys <- key_colnames(epi_data, exclude = "time_value") + epi_data <- epi_data %>% mutate(.idx = time_aggr(time_value), .weights = 1) + climate_center <- epi_data %>% + select(.idx, .weights, outcome, all_of(keys)) %>% + dplyr::reframe( + roll_modular_multivec(outcome, .idx, .weights, center_fn, window_size, + modulus), + .by = keys ) %>% - filter(.in_window) %>% - select(-.in_window) %>% - left_join(ahead_tib, by = ".ahead_set") - + rename(.pred = climate_pred) + # get the quantiles Quantile <- function(x) { - x <- x - median(x, na.rm = TRUE) + x <- x - stats::median(x, na.rm = TRUE) if (args_list$symmetrize) x <- c(x, -x) - list(unname(quantile(x, probs = probs, na.rm = TRUE, type = 8))) - } - quantiles <- group_by(epi_data, .ahead_set, ahead) %>% - summarise( - .pred_distn = dist_quantiles(Quantile(!!outcome), probs), - .by = , - .groups = "drop" - ) - - epi_data <- epi_data %>% - group_by(.ahead_set, ahead, args_list$quantile_by_key) %>% - summarise(.pred = median(!!outcome, na.rm = TRUE), .groups = "drop") %>% - left_join(quantiles, by = c(".ahead_set", "ahead")) %>% - mutate( - .pred_distn = .pred_distn + .pred, - forecast_date = ymd(forecast_date), - target_date = epiweek(forecast_date + weeks(ahead)), - .ahead_set = NULL - ) - - if (args_list$quantile_method == "epipredict") { - epi_data <- mutate( - epi_data, - .pred_distn = extrapolate_quantiles(.pred_distn, args_list$quantile_values) - ) + list(unname(quantile( + x, probs = args_list$quantile_levels, na.rm = TRUE, type = 8 + ))) } + climate_quantiles <- epi_data %>% + select(.idx, .weights, outcome, all_of(args_list$quantile_by_key)) %>% + dplyr::reframe( + roll_modular_multivec(outcome, .idx, .weights, Quantile, window_size, + modulus), + .by = args_list$quantile_by_key + ) %>% + rename(.pred_distn = climate_pred) + # combine them together + climate_table <- climate_center %>% + left_join(climate_quantiles, by = c(".idx", args_list$quantile_by_key)) %>% + mutate(.pred_distn = .pred_distn - median(.pred_distn) + .pred) if (args_list$nonneg) { - epi_data <- mutate( - epi_data, + climate_table <- mutate( + climate_table, .pred = snap(.pred, 0, Inf), .pred_distn = snap(.pred_distn, 0, Inf) ) } + # create the predictions + predictions <- epi_data %>% + select(all_of(keys)) %>% + dplyr::distinct() %>% + mutate(forecast_date = forecast_date, .idx = time_aggr(forecast_date)) + predictions <- map(horizon, ~ { + predictions %>% + mutate(.idx = .idx + .x, target_date = forecast_date + ttype_dur(.x)) + }) %>% + purrr::list_rbind() %>% + left_join(climate_table, by = c(".idx", keys)) %>% + select(-.idx) + structure(list( - predictions = epi_data, + predictions = predictions, + epi_workflow = epi_workflow(), metadata = list( training = attr(epi_data, "metadata"), forecast_created = Sys.time() @@ -113,55 +131,30 @@ climatological_forecaster <- function( #' Climatological forecaster argument constructor #' +#' @inheritParams epi_recipe +#' @param prediction_horizon Vector of integers giving the number of time steps, +#' in units of the `time_type`, +#' from the `reference_date` for which predictions should be produced. +#' @inheritParams step_climate #' @inheritParams flatline_args_list -#' @param ahead Vector of integers giving the number of time steps ahead -#' (in weeks) of the forecast date for which forecasts should be produced. -#' @param time_type The duration over which time aggregation should be performed. -#' @param center_method The measure of center to be calculated over the time -#' window. -#' @param window_size Integer. The number of time points on each side of the -#' target to include in the calculation. -#' @param quantile_method One of either `"base8"` or `"epipredict"`. The first -#' case uses the quantiles of the observed history within the window, calculated -#' using `type = 8`. See `?stats::quantile` for additional information. -#' Alternatively, `"epipredict"` computes only the quartiles of the observed -#' data and interpolates (or extrapolates the remainder). Those quantiles -#' between .25 and .75 are interpolated with a cubic spline, while those -#' outside this range are extrapolated on the logistic-linear scale. This -#' produces a "parametric" quantile estimate with tails that are heavier than -#' a normal distribution. See the Examples for this comparison. #' #' @return A list containing updated parameter choices with class `climate_alist`. #' @export +#' @seealso [climatological_predictor()], [step_climate()] #' #' @examples -#' #' climate_args_list() #' climate_args_list( #' ahead = 0:10, #' quantile_levels = c(.01, .025, 1:19 / 20, .975, .99) #' ) #' -#' # To visualize the quantiles produced with the `epipredict` method -#' tau <- c(.01, .025, 1:19 / 20, .975, .99) -#' sm_tau <- 5:15 / 20 # values between .25 and .75 -#' distn <- dist_quantiles(qnorm(sm_tau), sm_tau) -#' epipredict_quantiles <- extrapolate_quantiles(distn, tau) %>% -#' nested_quantiles %>% -#' purrr::pluck(1, "values") -#' -#' plot( -#' qnorm(tau), -#' epipredict_quantiles, -#' pch = 16, col = 4, ylab = "epipredict", xlab = "Normal quantiles" -#' ) -#' abline(0, 1, col = 2) climate_args_list <- function( - ahead = 1:4, forecast_date = NULL, + forecast_horizon = 0:4, time_type = c("epiweek", "week", "month", "day"), + center_method = c("median", "mean"), window_size = 3L, - quantile_method = c("base8", "epipredict"), quantile_levels = c(.05, .1, .25, .5, .75, .9, .95), symmetrize = FALSE, nonneg = TRUE, @@ -170,20 +163,21 @@ climate_args_list <- function( rlang::check_dots_empty() time_type <- arg_match(time_type) - quantile_method <- arg_match(quantile_method) if (time_type != "epiweek") { cli_abort("Only epiweek forecasts are currently supported.") } - arg_is_scalar(ahead, window_size, symmetrize, nonneg) + center_method <- rlang::arg_match(center_method) + arg_is_scalar(window_size, symmetrize, nonneg) arg_is_chr(quantile_by_key, allow_empty = TRUE) arg_is_scalar(forecast_date, allow_null = TRUE) arg_is_date(forecast_date, allow_null = TRUE) - arg_is_nonneg_int(ahead, window_size) + arg_is_nonneg_int(forecast_horizon, window_size) arg_is_lgl(symmetrize, nonneg) arg_is_probabilities(quantile_levels) + quantile_levels <- sort(unique(c(0.5, quantile_levels))) structure(enlist( - ahead, forecast_date, time_type, window_size, quantile_method, + forecast_date, forecast_horizon, time_type, center_method, window_size, quantile_levels, symmetrize, nonneg, quantile_by_key), class = c("climate_fcast", "alist") ) diff --git a/R/step_climate.R b/R/step_climate.R index cf3f2cc2..c5686a03 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -144,7 +144,7 @@ step_climate <- cli_abort(c("Automatic detection of the `forecast_ahead` is only supported if the original data and the time type for aggregation are in the same units.", - i = "Here, the data is in {.val {edf_time_type}} while + i = "Here, the data is in {.val {edf_time_type}}s while `time_type` is {.val {time_type}}.", i = "This is resolved most easily by specifying `forecast_ahead`." )) @@ -242,13 +242,16 @@ prep.step_climate <- function(x, training, info = NULL, ...) { modulus <- switch(x$time_type, epiweek = 53L, week = 53L, month = 12L, day = 365L) + fn <- switch(center_method, + mean = function(x, w) weighted.mean(x, w, na.rm = TRUE), + median = function(x, w) median(x, na.rm = TRUE)) + climate_table <- training %>% mutate(.idx = x$time_aggr(time_value), .weights = wts) %>% select(.idx, .weights, all_of(c(col_names, x$epi_keys))) %>% tidyr::pivot_longer(all_of(unname(col_names))) %>% dplyr::reframe( - roll_modular_multivec(value, .idx, .weights, x$center_method, - x$window_size, modulus), + roll_modular_multivec(value, .idx, .weights, fn, x$window_size, modulus), .by = c("name", x$epi_keys) ) %>% tidyr::pivot_wider( @@ -302,13 +305,7 @@ print.step_climate <- function(x, width = max(20, options()$width - 30), ...) { invisible(x) } -roll_modular_multivec <- function(col, .idx, weights, center_method, - window_size, modulus) { - if (center_method == "mean") { - aggr <- function(x, w) weighted.mean(x, w, na.rm = TRUE) - } else { - aggr <- function(x, w) median(x, na.rm = TRUE) - } +roll_modular_multivec <- function(col, .idx, weights, aggr, window_size, modulus) { tib <- tibble(col = col, weights = weights, .idx = .idx) |> arrange(.idx) |> tidyr::nest(data = c(col, weights), .by = .idx) diff --git a/man/arx_args_list.Rd b/man/arx_args_list.Rd index 5ece7109..650c4a61 100644 --- a/man/arx_args_list.Rd +++ b/man/arx_args_list.Rd @@ -101,3 +101,6 @@ arx_args_list() arx_args_list(symmetrize = FALSE) arx_args_list(quantile_levels = c(.1, .3, .7, .9), n_training = 120) } +\seealso{ +\code{\link[=arx_forecaster]{arx_forecaster()}} +} diff --git a/man/arx_fcast_epi_workflow.Rd b/man/arx_fcast_epi_workflow.Rd index c2e38218..61d293ba 100644 --- a/man/arx_fcast_epi_workflow.Rd +++ b/man/arx_fcast_epi_workflow.Rd @@ -58,5 +58,5 @@ arx_fcast_epi_workflow(jhu, "death_rate", ) } \seealso{ -\code{\link[=arx_forecaster]{arx_forecaster()}} +\code{\link[=arx_forecaster]{arx_forecaster()}}, \code{\link[=arx_args_list]{arx_args_list()}} } diff --git a/man/climate_args_list.Rd b/man/climate_args_list.Rd index 325b2c34..17136420 100644 --- a/man/climate_args_list.Rd +++ b/man/climate_args_list.Rd @@ -1,16 +1,16 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/climatological_forecaster.R +% Please edit documentation in R/climatological_predictor.R \name{climate_args_list} \alias{climate_args_list} \title{Climatological forecaster argument constructor} \usage{ climate_args_list( - ahead = 1:4, forecast_date = NULL, - time_type = c("epiweek", "week", "month", "year", "day"), + forecast_horizon = 0:4, + time_type = c("epiweek", "week", "month", "day"), + center_method = c("median", "mean"), window_size = 3L, - quantile_method = c("base8", "epipredict"), - quantile_levels = c(0.1, 0.25, 0.5, 0.75, 0.9), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95), symmetrize = FALSE, nonneg = TRUE, quantile_by_key = character(0L), @@ -18,9 +18,6 @@ climate_args_list( ) } \arguments{ -\item{ahead}{Vector of integers giving the number of time steps ahead -(in weeks) of the forecast date for which forecasts should be produced.} - \item{forecast_date}{Date. The date from which the forecast is occurring. The default \code{NULL} will determine this automatically from either \enumerate{ @@ -30,20 +27,16 @@ adjustment (the default case), or non-\code{NULL}. }} -\item{time_type}{Character. The duration to which the forecasts correspond.} +\item{time_type}{The duration over which time aggregation should be performed.} -\item{window_size}{Integer. The number of time points on each side of the -target to include in the calculation.} +\item{center_method}{The measure of center to be calculated over the time +window.} -\item{quantile_method}{One of either \code{"base8"} or \code{"epipredict"}. The first -case uses the quantiles of the observed history within the window, calculated -using \code{type = 8}. See \code{?stats::quantile} for additional information. -Alternatively, \code{"epipredict"} computes only the quartiles of the observed -data and interpolates (or extrapolates the remainder). Those quantiles -between .25 and .75 are interpolated with a cubic spline, while those -outside this range are extrapolated on the logistic-linear scale. This -produces a "parametric" quantile estimate with tails that are heavier than -a normal distribution. See the Examples for this comparison.} +\item{window_size}{Scalar integer. How many time units on each side should +be included. For example, if \code{window_size = 3} and \code{time_type = "day"}, +then on each day in the data, the center will be calculated using 3 days +before and three days after. So, in this case, it operates like a weekly +rolling average, centered at each day.} \item{quantile_levels}{Vector or \code{NULL}. A vector of probabilities to produce prediction intervals. These are created by computing the quantiles of @@ -64,7 +57,12 @@ before calculating residual quantiles. See the \code{by_key} argument to residual quantiles are used. It is not applicable with \code{trainer = quantile_reg()}, for example.} -\item{...}{Space to handle future expansions (unused).} +\item{...}{Further arguments passed to or from other methods (not currently +used).} + +\item{prediction_horizon}{Vector of integers giving the number of time steps, +in units of the \code{time_type}, +from the \code{reference_date} for which predictions should be produced.} } \value{ A list containing updated parameter choices with class \code{climate_alist}. @@ -73,25 +71,13 @@ A list containing updated parameter choices with class \code{climate_alist}. Climatological forecaster argument constructor } \examples{ - climate_args_list() climate_args_list( ahead = 0:10, quantile_levels = c(.01, .025, 1:19 / 20, .975, .99) ) -# To visualize the quantiles produced with the `epipredict` method -tau <- c(.01, .025, 1:19 / 20, .975, .99) -sm_tau <- 5:15 / 20 # values between .25 and .75 -distn <- dist_quantiles(qnorm(sm_tau), sm_tau) -epipredict_quantiles <- extrapolate_quantiles(distn, tau) \%>\% - nested_quantiles \%>\% - purrr::pluck(1, "values") - -plot( - qnorm(tau), - epipredict_quantiles, - pch = 16, col = 4, ylab = "epipredict", xlab = "Normal quantiles" -) -abline(0, 1, col = 2) +} +\seealso{ +\code{\link[=climatological_predictor]{climatological_predictor()}}, \code{\link[=step_climate]{step_climate()}} } diff --git a/man/climatological_forecaster.Rd b/man/climatological_forecaster.Rd index 249c37d8..3968f5ab 100644 --- a/man/climatological_forecaster.Rd +++ b/man/climatological_forecaster.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/climatological_forecaster.R +% Please edit documentation in R/climatological_predictor.R \name{climatological_forecaster} \alias{climatological_forecaster} \title{Climatological forecaster} @@ -20,7 +20,7 @@ for each unique combination of \code{key_vars}. } \description{ This is another "baseline" type forecaster, but it is especially appropriate -for strongly seasonal diseases (e.g., influenza). The idea is to forecast +for strongly seasonal diseases (e.g., influenza). The idea is to predict the "typical season" by summarizing over all available history in the \code{epi_data}. This is analogous to a "climate" forecast rather than a "weather" forecast, essentially predicting "typical January" behavior by relying on a @@ -28,10 +28,13 @@ long history of such periods rather than heavily using recent data. } \details{ The forecast is taken as the quantiles of the \code{outcome} in a small window -around the target week, computed over the entire available history. +around the target period, computed over the entire available history. } \examples{ 1 + 1 2 + 2 } +\seealso{ +\code{\link[=step_climate]{step_climate()}} +} diff --git a/man/epi_recipe.Rd b/man/epi_recipe.Rd index 9ef5eb28..98775eae 100644 --- a/man/epi_recipe.Rd +++ b/man/epi_recipe.Rd @@ -9,19 +9,37 @@ \usage{ epi_recipe(x, ...) -\method{epi_recipe}{default}(x, ...) +\method{epi_recipe}{epi_df}( + x, + reference_date = NULL, + formula = NULL, + ..., + vars = NULL, + roles = NULL +) -\method{epi_recipe}{epi_df}(x, formula = NULL, ..., vars = NULL, roles = NULL) - -\method{epi_recipe}{formula}(formula, data, ...) +\method{epi_recipe}{formula}(formula, data, reference_date = NULL, ...) } \arguments{ -\item{x, data}{A data frame, tibble, or epi_df of the \emph{template} data set -(see below). This is always coerced to the first row to avoid memory issues} +\item{x, data}{An epi_df of the \emph{template} data set (see below).} \item{...}{Further arguments passed to or from other methods (not currently used).} +\item{reference_date}{Either a date of the same class as the \code{time_value} +column in the \code{epi_df} or \code{NULL}. If a date, it gives the date to which all +operations are relative. Typically, in real-time tasks this is the date that +the model is created (and presumably trained). In forecasting, this is +often the same as the most recent date of +data availability, but when data is "latent" (reported after the date to +which it corresponds), or if performing a nowcast, the \code{reference_date} may +be later than this. Setting \code{reference_date} +to a value BEFORE the most recent data is not a true "forecast", +because future data is being used to create the model, but this may be +reasonable in model building, nowcasting (predicting finalized values from +preliminary data), or if producing a backcast. If \code{NULL}, it will be set +to the \code{as_of} date of the \code{epi_df}.} + \item{formula}{A model formula. No in-line functions should be used here (e.g. \code{log(x)}, \code{x:y}, etc.) and minus signs are not allowed. These types of transformations should be enacted using \code{step} functions in this package. From 0be6acf1dd1dce2d53c6f7d03947ee5d000f57bb Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Mon, 10 Feb 2025 15:48:14 -0800 Subject: [PATCH 23/54] missing autoplot branch --- R/autoplot.R | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/R/autoplot.R b/R/autoplot.R index c0e3c68d..ce6f4ce5 100644 --- a/R/autoplot.R +++ b/R/autoplot.R @@ -120,12 +120,13 @@ autoplot.epi_workflow <- function( shift <- -as.numeric(old_name_y[2]) new_name_y <- paste(old_name_y[-c(1:2)], collapse = "_") edf <- rename(edf, !!new_name_y := !!names(y)) + } else { + new_name_y <- names(y) + shift <- 0 } - if (!is.null(shift)) { - edf <- mutate(edf, time_value = time_value + shift) - } - other_keys <- setdiff(key_colnames(object), c("geo_value", "time_value")) + edf <- mutate(edf, time_value = time_value + shift) + other_keys <- key_colnames(object, exclude = c("geo_value", "time_value")) edf <- as_epi_df(edf, as_of = object$fit$meta$as_of, other_keys = other_keys From d464c199486ac3a62291ab1277c2a73d9e393c74 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 09:23:14 -0800 Subject: [PATCH 24/54] test args list --- R/climatological_forecaster.R | 142 +++++++----------- man/climate_args_list.Rd | 4 +- man/climatological_forecaster.Rd | 2 +- .../_snaps/climatological_forecaster.md | 112 ++++++++++++++ tests/testthat/test-climatological_baseline.R | 35 ----- .../testthat/test-climatological_forecaster.R | 28 ++++ 6 files changed, 196 insertions(+), 127 deletions(-) create mode 100644 tests/testthat/_snaps/climatological_forecaster.md delete mode 100644 tests/testthat/test-climatological_baseline.R create mode 100644 tests/testthat/test-climatological_forecaster.R diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index a5cfb7bd..47d2b618 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -20,9 +20,12 @@ #' @seealso [step_climate()] #' #' @examples +#' jhu <- covid_case_death_rates +#' # set as_of to the last day in the data +#' attr(jhu, "metadata")$as_of <- as.Date("2021-12-31") +#' fcast <- climatological_forecaster(jhu, "death_rate") #' -#' 1 + 1 -#' 2 + 2 + climatological_forecaster <- function(epi_data, outcome, args_list = climate_args_list()) { @@ -55,31 +58,40 @@ climatological_forecaster <- function(epi_data, )) } # process the time types - epi_data <- filter(epi_data, !is.na(!!outcome)) - ttype_dur <- switch(time_type, - epiweek = lubridate::weeks, week = lubridate::weeks, - month = lubridate::months, day = lubridate::days) - time_aggr <- switch(time_type, - epiweek = lubridate::epiweek, week = lubridate::week, - month = lubridate::month, day = lubridate::yday) - modulus <- switch(time_type, epiweek = 53L, week = 53L, month = 12L, day = 365L) - center_fn <- switch(args_list$center_method, - mean = function(x, w) mean(x, na.rm = TRUE), - median = function(x, w) stats::median(x, na.rm = TRUE)) + epi_data <- epi_data[!is.na(epi_data[outcome]), ] %>% + select(key_colnames(epi_data), outcome) + if (time_type %in% c("week", "epiweek")) { + ttype_dur <- lubridate::weeks + time_aggr <- ifelse(time_type == "week", lubridate::epiweek, lubridate::isoweek) + modulus <- 53L + } else if (time_type == "month") { + ttype_dur <- lubridate::months + time_aggr <- lubridate::month + modulus <- 12L + } else if (time_type == "day") { + ttype_dur <- lubridate::days + time_aggr <- lubridate::yday + modulus <- 365L + } + center_fn <- switch( + args_list$center_method, + mean = function(x, w) mean(x, na.rm = TRUE), + median = function(x, w) stats::median(x, na.rm = TRUE) + ) # get the point predictions - outcome <- sym(outcome) + sym_outcome <- sym(outcome) keys <- key_colnames(epi_data, exclude = "time_value") epi_data <- epi_data %>% mutate(.idx = time_aggr(time_value), .weights = 1) climate_center <- epi_data %>% select(.idx, .weights, outcome, all_of(keys)) %>% dplyr::reframe( - roll_modular_multivec(outcome, .idx, .weights, center_fn, window_size, + roll_modular_multivec(!!sym_outcome, .idx, .weights, center_fn, window_size, modulus), .by = keys ) %>% rename(.pred = climate_pred) # get the quantiles - Quantile <- function(x) { + Quantile <- function(x, w) { x <- x - stats::median(x, na.rm = TRUE) if (args_list$symmetrize) x <- c(x, -x) list(unname(quantile( @@ -89,15 +101,16 @@ climatological_forecaster <- function(epi_data, climate_quantiles <- epi_data %>% select(.idx, .weights, outcome, all_of(args_list$quantile_by_key)) %>% dplyr::reframe( - roll_modular_multivec(outcome, .idx, .weights, Quantile, window_size, + roll_modular_multivec(!!sym_outcome, .idx, .weights, Quantile, window_size, modulus), .by = args_list$quantile_by_key ) %>% - rename(.pred_distn = climate_pred) + rename(.pred_distn = climate_pred) %>% + mutate(.pred_distn = dist_quantiles(.pred_distn, args_list$quantile_levels)) # combine them together climate_table <- climate_center %>% left_join(climate_quantiles, by = c(".idx", args_list$quantile_by_key)) %>% - mutate(.pred_distn = .pred_distn - median(.pred_distn) + .pred) + mutate(.pred_distn = .pred_distn + .pred) if (args_list$nonneg) { climate_table <- mutate( climate_table, @@ -115,12 +128,29 @@ climatological_forecaster <- function(epi_data, mutate(.idx = .idx + .x, target_date = forecast_date + ttype_dur(.x)) }) %>% purrr::list_rbind() %>% + mutate(.idx = .idx %% modulus, + .idx = dplyr::case_when(.idx == 0 ~ modulus, TRUE ~ .idx) + ) %>% left_join(climate_table, by = c(".idx", keys)) %>% select(-.idx) + # fill in some extras for plotting methods, etc. + ewf <- epi_workflow() + ewf$trained <- TRUE + ewf$pre <- list(mold = list( + outcomes = select(epi_data, outcome), + extras = list(roles = list( + geo_value = select(epi_data, geo_value), + time_value = select(epi_data, time_value) + )) + )) + other_keys <- key_colnames(epi_data, exclude = c("time_value", "geo_value")) + if (length(other_keys) > 0) { + ewf$pre$mold$extras$roles$key = epi_data %>% select(all_of(other_keys)) + } structure(list( predictions = predictions, - epi_workflow = epi_workflow(), + epi_workflow = ewf, metadata = list( training = attr(epi_data, "metadata"), forecast_created = Sys.time() @@ -145,7 +175,7 @@ climatological_forecaster <- function(epi_data, #' @examples #' climate_args_list() #' climate_args_list( -#' ahead = 0:10, +#' forecast_horizon = 0:10, #' quantile_levels = c(.01, .025, 1:19 / 20, .975, .99) #' ) #' @@ -163,15 +193,13 @@ climate_args_list <- function( rlang::check_dots_empty() time_type <- arg_match(time_type) - if (time_type != "epiweek") { - cli_abort("Only epiweek forecasts are currently supported.") - } center_method <- rlang::arg_match(center_method) arg_is_scalar(window_size, symmetrize, nonneg) arg_is_chr(quantile_by_key, allow_empty = TRUE) arg_is_scalar(forecast_date, allow_null = TRUE) arg_is_date(forecast_date, allow_null = TRUE) - arg_is_nonneg_int(forecast_horizon, window_size) + arg_is_nonneg_int(window_size) + arg_is_int(forecast_horizon) arg_is_lgl(symmetrize, nonneg) arg_is_probabilities(quantile_levels) quantile_levels <- sort(unique(c(0.5, quantile_levels))) @@ -182,67 +210,3 @@ climate_args_list <- function( class = c("climate_fcast", "alist") ) } - - -#' @importFrom lubridate epiyear epiweek ymd -units_in_year <- function(years, units = c("epiweek", "week", "month", "day")) { - units <- arg_match(units) - if (units == "month") return(rep(12L, length(years))) - if (units == "day") return(c(365, 366)[lubridate::leap_year(years) + 1]) - unitf <- switch(units, epiweek = lubridate::epiweek, week = lubridate::isoweek) - mat <- outer(years, 25:31, function(x, y) paste0(x, "12", y)) - apply(mat, 1, function(x) max(unitf(lubridate::ymd(x)))) -} - -date_window_mod <- function(t0, time_value, left = 1L, right = 1L, - type = c("epiweek", "isoweek", "month", "day")) { - checkmate::assert_integerish(left, lower = 0, len = 1) - checkmate::assert_integerish(right, lower = 0, len = 1) - type <- arg_match(type) - unitf <- switch( - type, - epiweek = lubridate::epiweek, - iso = lubridate::isoweek, - month = lubridate::month, - day = lubridate::day - ) - yearf <- switch( - type, - epiweek = lubridate::epiyear, - isoweek = lubridate::isoyear, - month = lubridate::year, - day = lubridate::year - ) - cur_years <- yearf(unique(c(t0, time_value))) - ll <- vctrs::vec_recycle_common(t0 = t0, time_value = time_value) - t0 <- ll$t0 - time_value <- ll$time_value - - back_years <- cur_years - 1 - all_years <- sort(unique(c(cur_years, back_years))) - year_nunits <- units_in_year(all_years, type) - back_nunits <- year_nunits[match(yearf(time_value) - 1, all_years)] - forward_nunits <- year_nunits[match(yearf(time_value), all_years)] - - unit_diff <- unitf(t0) - unitf(time_value) - in_window <- ((unit_diff >= 0) & (unit_diff %% back_nunits <= left)) | - ((unit_diff <= 0) & (unit_diff %% forward_nunits <= right)) - - in_window -} - - -episeason <- function(time_value) { - time_value <- time_value - lubridate::dmonths(6) - paste0( - strftime(time_value, "%Y"), - "/", - strftime(time_value + lubridate::years(1), "%y") - ) -} - -season_week <- function(time_value, season_start_epiweek = 39) { - stopifnot(season_start_epiweek >= 0L, season_start_epiweek <= 53L) - time_value <- time_value - lubridate::weeks(season_start_epiweek) - lubridate::epiweek(time_value) -} diff --git a/man/climate_args_list.Rd b/man/climate_args_list.Rd index 17136420..3216d098 100644 --- a/man/climate_args_list.Rd +++ b/man/climate_args_list.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/climatological_predictor.R +% Please edit documentation in R/climatological_forecaster.R \name{climate_args_list} \alias{climate_args_list} \title{Climatological forecaster argument constructor} @@ -73,7 +73,7 @@ Climatological forecaster argument constructor \examples{ climate_args_list() climate_args_list( - ahead = 0:10, + forecast_horizon = 0:10, quantile_levels = c(.01, .025, 1:19 / 20, .975, .99) ) diff --git a/man/climatological_forecaster.Rd b/man/climatological_forecaster.Rd index 3968f5ab..64dff04c 100644 --- a/man/climatological_forecaster.Rd +++ b/man/climatological_forecaster.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/climatological_predictor.R +% Please edit documentation in R/climatological_forecaster.R \name{climatological_forecaster} \alias{climatological_forecaster} \title{Climatological forecaster} diff --git a/tests/testthat/_snaps/climatological_forecaster.md b/tests/testthat/_snaps/climatological_forecaster.md new file mode 100644 index 00000000..78043a20 --- /dev/null +++ b/tests/testthat/_snaps/climatological_forecaster.md @@ -0,0 +1,112 @@ +# climate args list validates properly + + Code + climate_args_list(forecast_date = 12345) + Condition + Error in `climate_args_list()`: + ! `forecast_date` must be a date. + +--- + + Code + climate_args_list(forecast_date = as.Date(c("2021-01-10", "2024-01-22"))) + Condition + Error in `climate_args_list()`: + ! `forecast_date` must be a scalar. + +--- + + Code + climate_args_list(forecast_horizon = 1.3) + Condition + Error in `climate_args_list()`: + ! `forecast_horizon` must be a integer. + +--- + + Code + climate_args_list(window_size = -1) + Condition + Error in `climate_args_list()`: + ! `window_size` must be a non-negative integer. + +--- + + Code + climate_args_list(window_size = 2.5) + Condition + Error in `climate_args_list()`: + ! `window_size` must be a non-negative integer. + +--- + + Code + climate_args_list(window_size = 1:3) + Condition + Error in `climate_args_list()`: + ! `window_size` must be a scalar. + +--- + + Code + climate_args_list(quantile_levels = -1) + Condition + Error in `climate_args_list()`: + ! `quantile_levels` must lie in [0, 1]. + +--- + + Code + climate_args_list(quantile_levels = 1.3) + Condition + Error in `climate_args_list()`: + ! `quantile_levels` must lie in [0, 1]. + +--- + + Code + climate_args_list(symmetrize = 2.5) + Condition + Error in `climate_args_list()`: + ! `symmetrize` must be of type . + +--- + + Code + climate_args_list(symmetrize = c(TRUE, TRUE)) + Condition + Error in `climate_args_list()`: + ! `symmetrize` must be a scalar. + +--- + + Code + climate_args_list(nonneg = 2.5) + Condition + Error in `climate_args_list()`: + ! `nonneg` must be of type . + +--- + + Code + climate_args_list(nonneg = c(TRUE, TRUE)) + Condition + Error in `climate_args_list()`: + ! `nonneg` must be a scalar. + +--- + + Code + climate_args_list(quantile_by_key = TRUE) + Condition + Error in `climate_args_list()`: + ! `quantile_by_key` must be of type . + +--- + + Code + climate_args_list(quantile_by_key = 2:3) + Condition + Error in `climate_args_list()`: + ! `quantile_by_key` must be of type . + diff --git a/tests/testthat/test-climatological_baseline.R b/tests/testthat/test-climatological_baseline.R deleted file mode 100644 index e4fa5207..00000000 --- a/tests/testthat/test-climatological_baseline.R +++ /dev/null @@ -1,35 +0,0 @@ -test_that("epiwindow function works", { - skip() - - t0 <- ymd("2024-01-08") - time_value <- ymd(c("2024-01-01", "2023-12-30", "2023-12-01", "2022-01-08")) - expect_snapshot(error = TRUE, epiwindow(t0, time_value, 1.5)) - expect_snapshot(error = TRUE, epiwindow(t0, time_value, 1, 1.5)) - expect_snapshot(error = TRUE, epiwindow(t0, time_value, seasons = "other")) - expect_snapshot(error = TRUE, epiwindow(c(t0, t0), time_value)) - - expect_identical(epiwindow(t0, time_value), c(TRUE, FALSE, FALSE, TRUE)) - time_value <- ymd(c("2024-01-01", "2023-12-31", "2023-12-01", "2022-01-08")) - expect_identical(epiwindow(t0, time_value), c(TRUE, TRUE, FALSE, TRUE)) - t0 <- ymd("20231231") - expect_identical(epiwindow(t0, time_value), c(TRUE, TRUE, FALSE, TRUE)) - expect_identical( - epiwindow(t0, time_value, seasons = "current"), - c(TRUE, TRUE, FALSE, FALSE) - ) - - # 2025 has 53 epiweeks in the year - t0 <- ymd("2026-01-08") # week 1 - # second is week 53 - time_value <- ymd(c("2026-01-01", "2025-12-27", "2025-12-01", "2022-01-08")) - expect_identical(epiwindow(t0, time_value), c(TRUE, FALSE, FALSE, TRUE)) - # second is week 52 - time_value <- ymd(c("2025-01-01", "2024-12-30", "2024-12-01", "2022-01-08")) - expect_identical(epiwindow(t0, time_value), c(TRUE, TRUE, FALSE, TRUE)) - t0 <- ymd("20251231") - expect_identical(epiwindow(t0, time_value), c(TRUE, TRUE, FALSE, TRUE)) - expect_identical( - epiwindow(t0, time_value, seasons = "current"), - c(TRUE, TRUE, FALSE, FALSE) - ) -}) diff --git a/tests/testthat/test-climatological_forecaster.R b/tests/testthat/test-climatological_forecaster.R new file mode 100644 index 00000000..3bee1319 --- /dev/null +++ b/tests/testthat/test-climatological_forecaster.R @@ -0,0 +1,28 @@ +test_that("climate args list validates properly", { + expect_s3_class(climate_args_list(), c("climate_fcast", "alist")) + expect_s3_class( + climate_args_list(forecast_date = as.Date("2021-01-10")), + c("climate_fcast", "alist") + ) + expect_snapshot(error = TRUE, climate_args_list(forecast_date = 12345)) + expect_snapshot( + error = TRUE, + climate_args_list(forecast_date = as.Date(c("2021-01-10", "2024-01-22"))) + ) + expect_silent(climate_args_list(forecast_horizon = 1L)) + expect_silent(climate_args_list(forecast_horizon = -1:4)) + expect_snapshot(error = TRUE, climate_args_list(forecast_horizon = 1.3)) + expect_snapshot(error = TRUE, climate_args_list(window_size = -1)) + expect_snapshot(error = TRUE, climate_args_list(window_size = 2.5)) + expect_snapshot(error = TRUE, climate_args_list(window_size = 1:3)) + expect_snapshot(error = TRUE, climate_args_list(quantile_levels = -1)) + expect_snapshot(error = TRUE, climate_args_list(quantile_levels = 1.3)) + expect_snapshot(error = TRUE, climate_args_list(symmetrize = 2.5)) + expect_snapshot(error = TRUE, climate_args_list(symmetrize = c(TRUE, TRUE))) + expect_snapshot(error = TRUE, climate_args_list(nonneg = 2.5)) + expect_snapshot(error = TRUE, climate_args_list(nonneg = c(TRUE, TRUE))) + expect_snapshot(error = TRUE, climate_args_list(quantile_by_key = TRUE)) + expect_snapshot(error = TRUE, climate_args_list(quantile_by_key = 2:3)) +}) + + From 7afbde8d89473c201001d220fde96c3eaf350ddf Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 09:46:07 -0800 Subject: [PATCH 25/54] add reasonable examples --- R/climatological_forecaster.R | 43 ++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index 47d2b618..65f36f33 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -20,12 +20,32 @@ #' @seealso [step_climate()] #' #' @examples -#' jhu <- covid_case_death_rates +#' rates <- cases_deaths_subset #' # set as_of to the last day in the data -#' attr(jhu, "metadata")$as_of <- as.Date("2021-12-31") -#' fcast <- climatological_forecaster(jhu, "death_rate") +#' attr(rates, "metadata")$as_of <- as.Date("2021-12-31") +#' fcast <- climatological_forecaster(rates, "case_rate_7d_av") +#' autoplot(fcast) #' - +#' # Compute quantiles separately by location, and a backcast +#' backcast <- climatological_forecaster( +#' rates, "case_rate_7d_av", +#' climate_args_list( +#' quantile_by_key = "geo_value", +#' forecast_date = as.Date("2021-06-01") +#' ) +#' ) +#' autoplot(backcast) +#' +#' # compute the climate "daily" rather than "weekly" +#' # use a two week window (on both sides) +#' daily_fcast <- climatological_forecaster( +#' rates, "case_rate_7d_av", +#' climate_args_list( +#' time_type = "day", window_size = 14L, forecast_horizon = 0:30 +#' ) +#' ) +#' autoplot(daily_fcast) + +#' ggplot2::coord_cartesian(xlim = c(as.Date("2021-10-01"), NA)) climatological_forecaster <- function(epi_data, outcome, args_list = climate_args_list()) { @@ -111,13 +131,6 @@ climatological_forecaster <- function(epi_data, climate_table <- climate_center %>% left_join(climate_quantiles, by = c(".idx", args_list$quantile_by_key)) %>% mutate(.pred_distn = .pred_distn + .pred) - if (args_list$nonneg) { - climate_table <- mutate( - climate_table, - .pred = snap(.pred, 0, Inf), - .pred_distn = snap(.pred_distn, 0, Inf) - ) - } # create the predictions predictions <- epi_data %>% select(all_of(keys)) %>% @@ -133,6 +146,14 @@ climatological_forecaster <- function(epi_data, ) %>% left_join(climate_table, by = c(".idx", keys)) %>% select(-.idx) + if (args_list$nonneg) { + predictions <- mutate( + predictions, + .pred = snap(.pred, 0, Inf), + .pred_distn = snap(.pred_distn, 0, Inf) + ) + } + # fill in some extras for plotting methods, etc. ewf <- epi_workflow() ewf$trained <- TRUE From 151d8ea5fd4b8b2f838dae41de75802073bacc08 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 09:54:23 -0800 Subject: [PATCH 26/54] tests pass --- R/step_climate.R | 2 +- .../_snaps/climatological_baseline.md | 32 ------------------- tests/testthat/_snaps/epi_recipe.md | 8 ++--- tests/testthat/test-step_climate.R | 16 ++++++---- 4 files changed, 15 insertions(+), 43 deletions(-) delete mode 100644 tests/testthat/_snaps/climatological_baseline.md diff --git a/R/step_climate.R b/R/step_climate.R index c5686a03..01762b75 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -242,7 +242,7 @@ prep.step_climate <- function(x, training, info = NULL, ...) { modulus <- switch(x$time_type, epiweek = 53L, week = 53L, month = 12L, day = 365L) - fn <- switch(center_method, + fn <- switch(x$center_method, mean = function(x, w) weighted.mean(x, w, na.rm = TRUE), median = function(x, w) median(x, na.rm = TRUE)) diff --git a/tests/testthat/_snaps/climatological_baseline.md b/tests/testthat/_snaps/climatological_baseline.md deleted file mode 100644 index 6270e282..00000000 --- a/tests/testthat/_snaps/climatological_baseline.md +++ /dev/null @@ -1,32 +0,0 @@ -# epiwindow function works - - Code - epiwindow(t0, time_value, 1.5) - Condition - Error in `epiwindow()`: - ! Assertion on 'left' failed: Must be of type 'integerish', but element 1 is not close to an integer. - ---- - - Code - epiwindow(t0, time_value, 1, 1.5) - Condition - Error in `epiwindow()`: - ! Assertion on 'right' failed: Must be of type 'integerish', but element 1 is not close to an integer. - ---- - - Code - epiwindow(t0, time_value, seasons = "other") - Condition - Error in `epiwindow()`: - ! `seasons` must be one of "all" or "current", not "other". - ---- - - Code - epiwindow(c(t0, t0), time_value) - Condition - Error in `epiwindow()`: - ! Can't recycle `t0` (size 2) to match `time_value` (size 4). - diff --git a/tests/testthat/_snaps/epi_recipe.md b/tests/testthat/_snaps/epi_recipe.md index 24b04667..c63bf8f0 100644 --- a/tests/testthat/_snaps/epi_recipe.md +++ b/tests/testthat/_snaps/epi_recipe.md @@ -3,8 +3,8 @@ Code epi_recipe(tib) Condition - Error in `epi_recipe()`: - ! `x` must be an or a , not a . + Error in `UseMethod()`: + ! no applicable method for 'epi_recipe' applied to an object of class "c('tbl_df', 'tbl', 'data.frame')" --- @@ -19,8 +19,8 @@ Code epi_recipe(m) Condition - Error in `epi_recipe()`: - ! `x` must be an or a , not a . + Error in `UseMethod()`: + ! no applicable method for 'epi_recipe' applied to an object of class "c('matrix', 'array', 'character')" # add/update/adjust/remove epi_recipe works as intended diff --git a/tests/testthat/test-step_climate.R b/tests/testthat/test-step_climate.R index c786791e..ab71aa98 100644 --- a/tests/testthat/test-step_climate.R +++ b/tests/testthat/test-step_climate.R @@ -5,18 +5,22 @@ test_that("roll_modular_multivec works", { w = rep(1, 10) ) modulus <- 3L + + Mean = function(x, w) weighted.mean(x, w, na.rm = TRUE) + Median = function(x, w) median(x, na.rm = TRUE) + # unweighted mean expected_res <- tib |> mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus ) |> summarise(climate_pred = weighted.mean(col, w = w), .by = .idx) expect_equal( - roll_modular_multivec(tib$col, tib$.idx, tib$w, "mean", 0, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, Mean, 0, modulus), expected_res ) w_size <- 1L expected_res <- tibble(.idx = as.double(1:3), climate_pred = mean(tib$col)) expect_equal( - roll_modular_multivec(tib$col, tib$.idx, tib$w, "mean", 1L, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, Mean, 1L, modulus), expected_res ) # weighted mean @@ -25,7 +29,7 @@ test_that("roll_modular_multivec works", { mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus ) |> summarise(climate_pred = weighted.mean(col, w = w), .by = .idx) expect_equal( - roll_modular_multivec(tib$col, tib$.idx, tib$w, "mean", 0, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, Mean, 0, modulus), expected_res ) tib$w <- c(1, 2, 3, 1, 2, 1, 1, 2, 2, 1) @@ -34,7 +38,7 @@ test_that("roll_modular_multivec works", { climate_pred = weighted.mean(tib$col, tib$w) ) expect_equal( - roll_modular_multivec(tib$col, tib$.idx, tib$w, "mean", 1L, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, Mean, 1L, modulus), expected_res ) # median @@ -42,12 +46,12 @@ test_that("roll_modular_multivec works", { mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus ) |> summarise(climate_pred = median(col), .by = .idx) expect_equal( - roll_modular_multivec(tib$col, tib$.idx, tib$w, "median", 0, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, Median, 0, modulus), expected_res ) expected_res <- tibble(.idx = as.double(1:3), climate_pred = median(tib$col)) expect_equal( - roll_modular_multivec(tib$col, tib$.idx, tib$w, "median", 1L, modulus), + roll_modular_multivec(tib$col, tib$.idx, tib$w, Median, 1L, modulus), expected_res ) }) From 381a29850b149c5fb706fffe609aa58e890bb616 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 09:59:02 -0800 Subject: [PATCH 27/54] add snapshot tests --- tests/testthat/_snaps/snapshots.md | 1178 +++++++++++++++++ .../testthat/test-climatological_forecaster.R | 2 - tests/testthat/test-snapshots.R | 28 + 3 files changed, 1206 insertions(+), 2 deletions(-) diff --git a/tests/testthat/_snaps/snapshots.md b/tests/testthat/_snaps/snapshots.md index 17191e04..517d76d2 100644 --- a/tests/testthat/_snaps/snapshots.md +++ b/tests/testthat/_snaps/snapshots.md @@ -1288,3 +1288,1181 @@ 19001, 19001, 19001, 19001, 19001, 19001, 19001), class = "Date")), row.names = c(NA, -53L), class = c("tbl_df", "tbl", "data.frame")) +# climatological_forecaster snapshots + + structure(list(geo_value = c("ca", "fl", "ga", "ny", "pa", "tx", + "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", + "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", + "pa", "tx"), forecast_date = structure(c(18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992 + ), class = "Date"), target_date = structure(c(18992, 18992, 18992, + 18992, 18992, 18992, 18999, 18999, 18999, 18999, 18999, 18999, + 19006, 19006, 19006, 19006, 19006, 19006, 19013, 19013, 19013, + 19013, 19013, 19013, 19020, 19020, 19020, 19020, 19020, 19020 + ), class = "Date"), .pred = c(81.6909143, 46.9476797, 57.1427664, + 55.4893801, 64.9577509, 49.3180127, 92.3266162, 51.49632575, + 62.0313808, 69.29024775, 65.2064021, 60.734368, 97.9375799, 52.0734516, + 66.9333338, 70.0729902, 60.5814898, 62.3893953, 94.69837105, + 52.17697935, 69.7197773, 67.80972325, 57.0623769, 66.48962015, + 75.3837738, 51.3826096, 67.5469116, 65.9446612, 45.2947493, 67.3274732 + ), .pred_distn = structure(list(structure(list(values = c(37.581706945, + 40.53309523, 68.6068873166667, 81.6909143, 101.23192885, 124.123961743333, + 133.701228665), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(2.838472345, 5.78986063, + 33.8636527166667, 46.9476797, 66.48869425, 89.3807271433334, + 98.957994065), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(13.033559045, 15.98494733, + 44.0587394166667, 57.1427664, 76.68378095, 99.5758138433333, + 109.153080765), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(11.380172745, 14.33156103, + 42.4053531166667, 55.4893801, 75.03039465, 97.9224275433334, + 107.499694465), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(20.848543545, 23.79993183, + 51.8737239166667, 64.9577509, 84.49876545, 107.390798343333, + 116.968065265), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(5.208805345, 8.16019363, + 36.2339857166667, 49.3180127, 68.85902725, 91.7510601433333, + 101.328327065), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(46.0821344, 60.71441945, + 80.2739618916667, 92.3266162, 108.315284833333, 130.664387783333, + 140.133233), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(5.25184394999999, 19.884129, + 39.4436714416667, 51.49632575, 67.4849943833333, 89.8340973333333, + 99.30294255), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(15.786899, 30.41918405, + 49.9787264916667, 62.0313808, 78.0200494333333, 100.369152383333, + 109.8379976), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(23.04576595, 37.678051, + 57.2375934416667, 69.29024775, 85.2789163833333, 107.628019333333, + 117.09686455), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(18.9619203, 33.59420535, + 53.1537477916667, 65.2064021, 81.1950707333333, 103.544173683333, + 113.0130189), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(14.4898862, 29.12217125, + 48.6817136916667, 60.734368, 76.7230366333333, 99.0721395833334, + 108.5409848), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(71.810054805, 79.4526884866667, + 88.220075625, 97.9375799, 114.304113091667, 137.30686307, 146.48749288 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(25.945926505, 33.5885601866667, 42.355947325, + 52.0734516, 68.4399847916667, 91.44273477, 100.62336458), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(40.805808705, 48.4484423866667, + 57.215829525, 66.9333338, 83.2998669916667, 106.30261697, 115.48324678 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(43.945465105, 51.5880987866667, 60.355485925, + 70.0729902, 86.4395233916667, 109.44227337, 118.62290318), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(34.453964705, 42.0965983866667, + 50.863985525, 60.5814898, 76.9480229916667, 99.95077297, 109.13140278 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(36.261870205, 43.9045038866667, 52.671891025, + 62.3893953, 78.7559284916667, 101.75867847, 110.93930828), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(71.98481162, 75.1198124633333, + 84.7910693916667, 94.69837105, 109.307554591667, 131.848629753333, + 140.895032215), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(29.46341992, 32.5984207633333, + 42.2696776916667, 52.17697935, 66.7861628916667, 89.3272380533333, + 98.373640515), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(47.00621787, 50.1412187133333, + 59.8124756416667, 69.7197773, 84.3289608416667, 106.870036003333, + 115.916438465), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(45.09616382, 48.2311646633333, + 57.9024215916667, 67.80972325, 82.4189067916667, 104.959981953333, + 114.006384415), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(34.34881747, 37.4838183133333, + 47.1550752416667, 57.0623769, 71.6715604416667, 94.2126356033334, + 103.259038065), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(43.77606072, 46.9110615633333, + 56.5823184916667, 66.48962015, 81.0988036916667, 103.639878853333, + 112.686281315), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(46.908072705, 51.4679015966667, + 60.7768339583333, 75.3837738, 89.767610275, 102.406549163333, + 116.665952285), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(22.906908505, 27.4667373966667, + 36.7756697583333, 51.3826096, 65.766446075, 78.4053849633334, + 92.664788085), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(39.071210505, 43.6310393966667, + 52.9399717583333, 67.5469116, 81.930748075, 94.5696869633334, + 108.829090085), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(37.468960105, 42.0287889966667, + 51.3377213583333, 65.9446612, 80.328497675, 92.9674365633334, + 107.226839685), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(16.819048205, 21.3788770966667, + 30.6878094583333, 45.2947493, 59.678585775, 72.3175246633334, + 86.576927785), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(38.851772105, 43.4116009966667, + 52.7205333583333, 67.3274732, 81.711309675, 94.3502485633334, + 108.609651685), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr"))), class = c("distribution", "vctrs_vctr", "list" + ))), row.names = c(NA, -30L), class = c("tbl_df", "tbl", "data.frame" + )) + +--- + + structure(list(geo_value = c("ca", "fl", "ga", "ny", "pa", "tx", + "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", + "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", + "pa", "tx"), forecast_date = structure(c(18779, 18779, 18779, + 18779, 18779, 18779, 18779, 18779, 18779, 18779, 18779, 18779, + 18779, 18779, 18779, 18779, 18779, 18779, 18779, 18779, 18779, + 18779, 18779, 18779, 18779, 18779, 18779, 18779, 18779, 18779 + ), class = "Date"), target_date = structure(c(18779, 18779, 18779, + 18779, 18779, 18779, 18786, 18786, 18786, 18786, 18786, 18786, + 18793, 18793, 18793, 18793, 18793, 18793, 18800, 18800, 18800, + 18800, 18800, 18800, 18807, 18807, 18807, 18807, 18807, 18807 + ), class = "Date"), .pred = c(4.5027417, 6.6356332, 6.06441615, + 6.0225729, 5.3742185, 4.7252087, 4.5167124, 7.262058, 5.76229575, + 3.88009725, 4.3058565, 5.0086288, 4.7631049, 7.5289294, 5.493522, + 3.38954425, 4.0672631, 5.5988237, 6.6727377, 7.9200341, 6.12777475, + 3.37439915, 3.8526967, 6.8619285, 7.53783305, 10.69490535, 7.3882769, + 3.41133835, 3.62304355, 8.11067975), .pred_distn = structure(list( + structure(list(values = c(2.38454615, 2.47051743333333, 3.248099325, + 4.5027417, 5.70162214166667, 7.33486465, 8.302502625), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2.941008575, 3.04656301666667, 3.4802291, + 6.6356332, 9.54985604166666, 14.0389050833333, 15.40788105 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(3.084228825, 3.18927068333333, + 3.79729063333333, 6.06441615, 6.82660870833333, 7.91693196666667, + 8.55974365), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1.736328725, + 1.99287171666667, 3.29602638333333, 6.0225729, 9.486795875, + 12.0870102666667, 15.46498015), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(1.857899425, 2.42411633333333, 3.72101395833333, + 5.3742185, 8.371536425, 12.3141013833333, 15.1794572), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(2.980046525, 3.21736526666667, + 3.60125955, 4.7252087, 7.12831905833333, 8.08197281666667, + 9.6703417), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2.19893535, + 2.37792371666667, 2.69084345, 4.5167124, 6.748578625, 9.16127798333333, + 13.412516575), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2.96812295, + 3.28451243333333, 3.59197331666667, 7.262058, 10.3093879, + 14.0389050833333, 16.80747705), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2.9968607, 3.16970731666667, 3.48405473333333, + 5.76229575, 6.78714855, 8.2655153, 12.266553825), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(1.699020075, 1.76237088333333, 2.94184070833333, + 3.88009725, 7.6115141, 9.69187023333334, 10.53857905), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(1.429325275, 1.64221546666667, + 3.2692511, 4.3058565, 6.54110969166667, 9.77171271666667, + 11.50947725), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2.980046525, + 3.29951246666667, 3.72906213333333, 5.0086288, 7.14401055833333, + 10.4355353, 13.931860575), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2.17308045, 2.37260151666667, 2.6744535, 4.7631049, + 7.157146375, 14.3770701333333, 16.921886375), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3.320610175, 3.4718483, 5.29081370833333, + 7.5289294, 10.5415857, 21.2699595666667, 32.681890075 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(2.9928591, 3.15370095, + 3.46704794166667, 5.493522, 6.90330591666667, 14.4753227333333, + 19.3650486), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1.699020075, + 1.76237088333333, 2.32421669166667, 3.38954425, 5.38881871666667, + 8.20912935, 9.0466034), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1.37680125, + 1.4762617, 2.55570593333333, 4.0672631, 5.09530074166667, + 6.57891956666667, 8.144025225), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2.980046525, 3.396743, 3.95721734166667, 5.5988237, + 8.03927734166667, 17.0052045833334, 21.980382575), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2.17308045, 2.37260151666667, 2.6744535, 6.6727377, + 9.73053901666666, 17.8936369166667, 19.9899087), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3.35479075, 3.48718568333333, 6.60210994166667, + 7.9200341, 15.6093492, 36.5094573833333, 41.443292225 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(2.9928591, 3.15370095, + 3.46704794166667, 6.12777475, 8.7768301, 23.1434428666667, + 25.52850425), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1.699020075, + 1.76237088333333, 2.32421669166667, 3.37439915, 3.84931453333333, + 6.2235223, 7.467820475), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1.37680125, + 1.4762617, 2.18002845, 3.8526967, 4.80334515833333, 5.6115081, + 5.8715209), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2.992210475, + 3.5098677, 4.2314739, 6.8619285, 10.5259945583333, 22.3190674833333, + 24.1472689), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2.17308045, + 2.41451368333333, 3.061490575, 7.53783305, 15.2485158416667, + 20.8146644333333, 22.099485925), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(4.02049035, 5.14340998333333, 7.262058, 10.69490535, + 29.911455775, 47.71367525, 51.2570617), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2.9928591, 3.15370095, 3.50495200833333, 7.3882769, + 15.6448998, 27.4038069, 31.796668175), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(1.699020075, 1.76237088333333, 2.32421669166667, + 3.41133835, 3.99577863333333, 5.58521231666667, 6.239036775 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(1.37680125, 1.4762617, + 2.18002845, 3.62304355, 4.475069675, 5.69346058333333, 6.07323565 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(3.765229625, 4.06819315, + 5.00246570833333, 8.11067975, 17.418860025, 27.88764355, + 29.913711925), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr"))), class = c("distribution", + "vctrs_vctr", "list"))), row.names = c(NA, -30L), class = c("tbl_df", + "tbl", "data.frame")) + +--- + + structure(list(geo_value = c("ca", "fl", "ga", "ny", "pa", "tx", + "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", + "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", + "pa", "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", + "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", + "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", + "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", "tx", + "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", + "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", + "pa", "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", + "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", + "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", + "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", "tx", + "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", + "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", "ny", + "pa", "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", "ga", + "ny", "pa", "tx", "ca", "fl", "ga", "ny", "pa", "tx", "ca", "fl", + "ga", "ny", "pa", "tx"), forecast_date = structure(c(18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, 18992, + 18992, 18992, 18992, 18992), class = "Date"), target_date = structure(c(18992, + 18992, 18992, 18992, 18992, 18992, 18993, 18993, 18993, 18993, + 18993, 18993, 18994, 18994, 18994, 18994, 18994, 18994, 18995, + 18995, 18995, 18995, 18995, 18995, 18996, 18996, 18996, 18996, + 18996, 18996, 18997, 18997, 18997, 18997, 18997, 18997, 18998, + 18998, 18998, 18998, 18998, 18998, 18999, 18999, 18999, 18999, + 18999, 18999, 19000, 19000, 19000, 19000, 19000, 19000, 19001, + 19001, 19001, 19001, 19001, 19001, 19002, 19002, 19002, 19002, + 19002, 19002, 19003, 19003, 19003, 19003, 19003, 19003, 19004, + 19004, 19004, 19004, 19004, 19004, 19005, 19005, 19005, 19005, + 19005, 19005, 19006, 19006, 19006, 19006, 19006, 19006, 19007, + 19007, 19007, 19007, 19007, 19007, 19008, 19008, 19008, 19008, + 19008, 19008, 19009, 19009, 19009, 19009, 19009, 19009, 19010, + 19010, 19010, 19010, 19010, 19010, 19011, 19011, 19011, 19011, + 19011, 19011, 19012, 19012, 19012, 19012, 19012, 19012, 19013, + 19013, 19013, 19013, 19013, 19013, 19014, 19014, 19014, 19014, + 19014, 19014, 19015, 19015, 19015, 19015, 19015, 19015, 19016, + 19016, 19016, 19016, 19016, 19016, 19017, 19017, 19017, 19017, + 19017, 19017, 19018, 19018, 19018, 19018, 19018, 19018, 19019, + 19019, 19019, 19019, 19019, 19019, 19020, 19020, 19020, 19020, + 19020, 19020, 19021, 19021, 19021, 19021, 19021, 19021, 19022, + 19022, 19022, 19022, 19022, 19022), class = "Date"), .pred = c(101.37020155, + 52.0218521, 62.8203618, 73.403801, 65.16337705, 61.26228355, + 101.6955195, 59.319734, 64.149558, 76.1701803, 64.8717008, 62.1894199, + 101.4527557, 62.0988778, 68.7867389, 78.77218, 64.20397455, 62.69179115, + 101.2099919, 62.7667137, 75.1419375, 79.0270607, 63.5362483, + 63.2087591, 101.12743775, 63.1039182, 75.78419345, 78.742998, + 63.10376285, 63.8527187, 101.0448836, 63.4411227, 76.2677194, + 78.4589353, 62.6712774, 64.866949, 100.88485545, 64.19703935, + 77.2167642, 78.24801225, 61.857713, 67.0637587, 100.7248273, + 64.952956, 78.165809, 78.0370892, 61.5436861, 69.4590841, 100.02084865, + 64.19703935, 78.3985684, 77.4833701, 59.9076171, 69.5145517, + 99.31687, 63.4411227, 78.6313278, 76.929651, 58.2402571, 69.5700193, + 100.02084865, 63.1039182, 78.72936685, 76.54991565, 58.0078102, + 70.04879245, 99.31687, 62.7667137, 78.6313278, 76.1701803, 57.919525, + 70.5275656, 100.167269, 62.36574925, 78.3985684, 75.3593641, + 57.55465035, 72.25290055, 101.0448836, 61.9647848, 78.165809, + 74.5485479, 57.5540916, 73.9782355, 101.12743775, 61.69791335, + 77.2167642, 74.41482785, 57.4451321, 74.43462695, 101.2099919, + 61.4310419, 76.2677194, 74.2811078, 57.3361726, 74.8910184, 101.0448836, + 61.4310419, 76.2677194, 74.2811078, 54.230547, 73.9782355, 97.9375799, + 61.4310419, 76.2677194, 74.2811078, 52.5229559, 70.5275656, 93.4734845, + 59.6155274, 75.3006675, 74.2811078, 51.1182163, 70.5275656, 88.3355291, + 56.276348, 73.214503, 74.2811078, 48.9110877, 69.5700193, 82.4903292, + 54.9117542, 72.5102224, 74.2811078, 46.0926682, 69.4590841, 75.3837738, + 54.3550052, 71.3284182, 74.0749869, 45.2947493, 69.244512, 68.7398847, + 52.4067123, 70.0212307, 71.2786868, 44.2308575, 69.244512, 62.5379781, + 52.2805071, 69.4183239, 69.7745211, 43.9738248, 68.2670168, 61.091556, + 51.8545645, 67.9150583, 68.8059744, 43.8218402, 67.996004, 57.9203863, + 51.7086397, 67.5469116, 67.743602, 43.7547882, 67.3274732, 55.6730978, + 51.3826096, 66.5278389, 66.5017049, 43.4921678, 67.1732343, 54.4077507, + 49.40408, 65.3006833, 65.9446612, 42.5970235, 66.8477269, 53.3949649, + 48.4509678, 64.2362592, 65.8523132, 41.9745574, 64.6251297, 52.1648167, + 48.4279616, 61.8139608, 63.8332146, 40.8290856, 63.945408, 50.5057495, + 47.2796257, 58.2898901, 63.0818705, 40.4021878, 62.0818906), + .pred_distn = structure(list(structure(list(values = c(55.804902835, + 69.68485497, 91.052146075, 101.37020155, 120.408758675, 144.049577316667, + 159.65571585), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(6.45655338499999, + 20.33650552, 41.703796625, 52.0218521, 71.060409225, 94.7012278666667, + 110.3073664), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(17.255063085, + 31.13501522, 52.502306325, 62.8203618, 81.858918925, 105.499737566667, + 121.1058761), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(27.838502285, + 41.71845442, 63.085745525, 73.403801, 92.442358125, 116.083176766667, + 131.6893153), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(19.598078335, + 33.47803047, 54.845321575, 65.16337705, 84.201934175, 107.842752816667, + 123.44889135), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(15.696984835, + 29.57693697, 50.944228075, 61.26228355, 80.300840675, 103.941659316667, + 119.54779785), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(59.13969995, + 72.85921385, 91.009447025, 101.6955195, 120.195629141667, + 143.396761416667, 159.12550815), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(16.76391445, 30.48342835, 48.633661525, 59.319734, + 77.8198436416667, 101.020975916667, 116.74972265), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(21.59373845, 35.31325235, 53.463485525, 64.149558, + 82.6496676416667, 105.850799916667, 121.57954665), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(33.61436075, 47.33387465, 65.484107825, 76.1701803, + 94.6702899416667, 117.871422216667, 133.60016895), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(22.31588125, 36.03539515, 54.185628325, 64.8717008, + 83.3718104416667, 106.572942716667, 122.30168945), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(19.63360035, 33.35311425, 51.503347425, 62.1894199, + 80.6895295416667, 103.890661816667, 119.61940855), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(62.40728398, 78.04363038, 89.9905976333334, + 101.4527557, 119.026258308333, 142.88478723, 157.987648545 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(23.05340608, 38.68975248, + 50.6367197333333, 62.0988778, 79.6723804083333, 103.53090933, + 118.633770645), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(29.74126718, + 45.37761358, 57.3245808333333, 68.7867389, 86.3602415083333, + 110.21877043, 125.321631745), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(39.72670828, 55.36305468, 67.3100219333333, + 78.77218, 96.3456826083333, 120.20421153, 135.307072845 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(25.15850283, 40.79484923, + 52.7418164833333, 64.20397455, 81.7774771583333, 105.63600608, + 120.738867395), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(23.64631943, + 39.28266583, 51.2296330833333, 62.69179115, 80.2652937583333, + 104.12382268, 119.226683995), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(63.9611915, 78.8035023033333, 88.854864075, + 101.2099919, 118.207198825, 142.57565984, 157.337373165 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(25.5179133, 40.3602241033333, + 50.411585875, 62.7667137, 79.763920625, 104.13238164, 118.894094965 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(37.8931371, 52.7354479033333, + 62.786809675, 75.1419375, 92.139144425, 116.50760544, 131.269318765 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(41.7782603, 56.6205711033333, + 66.671932875, 79.0270607, 96.024267625, 120.39272864, 135.154441965 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(26.2874479, 41.1297587033333, + 51.181120475, 63.5362483, 80.533455225, 104.90191624, 119.663629565 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(25.9599587, 40.8022695033333, + 50.853631275, 63.2087591, 80.205966025, 104.57442704, 119.336140365 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(65.95252258, 78.2259029966667, + 88.1360268333333, 101.12743775, 116.914585325, 140.37480679, + 156.763584085), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(27.92900303, + 40.2023834466667, 50.1125072833333, 63.1039182, 78.891065775, + 102.35128724, 118.740064535), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(40.60927828, 52.8826586966667, 62.7927825333333, + 75.78419345, 91.571341025, 115.03156249, 131.420339785 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(43.56808283, 55.8414632466667, + 65.7515870833333, 78.742998, 94.530145575, 117.99036704, + 134.379144335), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(27.92884768, + 40.2022280966667, 50.1123519333333, 63.10376285, 78.890910425, + 102.35113189, 118.739909185), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(28.67780353, 40.9511839466667, 50.8613077833333, + 63.8527187, 79.639866275, 103.10008774, 119.488865035 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(71.64318726, 79.0626539133333, + 87.712093725, 101.0448836, 116.117290991667, 138.57469487, + 156.653689055), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(34.03942636, + 41.4588930133333, 50.108332825, 63.4411227, 78.5135300916667, + 100.97093397, 119.049928155), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(46.86602306, 54.2854897133333, 62.934929525, + 76.2677194, 91.3401267916667, 113.79753067, 131.876524855 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(49.05723896, 56.4767056133333, + 65.126145425, 78.4589353, 93.5313426916667, 115.98874657, + 134.067740755), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(33.26958106, + 40.6890477133333, 49.338487525, 62.6712774, 77.7436847916667, + 100.20108867, 118.280082855), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(35.46525266, 42.8847193133333, 51.534159125, + 64.866949, 79.9393563916667, 102.39676027, 120.475754455 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(73.96720985, 79.2443040833333, + 86.6722945166667, 100.88485545, 114.464257225, 136.2687016, + 157.199207575), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(37.27939375, + 42.5564879833333, 49.9844784166667, 64.19703935, 77.776441125, + 99.5808855, 120.511391475), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(50.2991186, 55.5762128333333, 63.0042032666667, + 77.2167642, 90.796165975, 112.60061035, 133.531116325 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(51.33036665, 56.6074608833333, + 64.0354513166667, 78.24801225, 91.827414025, 113.6318584, + 134.562364375), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(34.9400674, + 40.2171616333333, 47.6451520666667, 61.857713, 75.437114775, + 97.24155915, 118.172065125), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(40.1461131, 45.4232073333333, 52.8511977666667, + 67.0637587, 80.643160475, 102.44760485, 123.378110825 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(73.643164885, 79.18261424, + 86.8010077916667, 100.7248273, 113.532252125, 134.676285906667, + 157.3919414), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(37.871293585, + 43.41074294, 51.0291364916667, 64.952956, 77.760380825, 98.9044146066667, + 121.6200701), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(51.084146585, + 56.62359594, 64.2419894916667, 78.165809, 90.973233825, 112.117267606667, + 134.8329231), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.955426785, + 56.49487614, 64.1132696916667, 78.0370892, 90.844514025, + 111.988547806667, 134.7042033), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(34.462023685, 40.00147304, 47.6198665916667, + 61.5436861, 74.351110925, 95.4951447066667, 118.2108002 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(42.377421685, 47.91687104, + 55.5352645916667, 69.4590841, 82.266508925, 103.410542706667, + 126.1261982), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(73.28789219, + 78.61548023, 86.37959655, 100.02084865, 112.542570958333, + 133.627430296667, 150.8689182), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(37.46408289, 42.79167093, 50.55578725, 64.19703935, + 76.7187616583333, 97.8036209966667, 115.0451089), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(51.66561194, 56.99319998, 64.7573163, 78.3985684, + 90.9202907083333, 112.005150046667, 129.24663795), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(50.75041364, 56.07800168, 63.842118, 77.4833701, + 90.0050924083333, 111.089951746667, 128.33143965), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(33.17466064, 38.50224868, 46.266365, 59.9076171, + 72.4293394083333, 93.5141987466667, 110.75568665), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(42.78159524, 48.10918328, 55.8732996, 69.5145517, + 82.0362740083333, 103.121133346667, 120.36262125), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(72.71769726, 78.2236376733333, 85.7751456, + 99.31687, 111.522466358333, 132.57099059, 152.102902555 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(36.84194996, 42.3478903733333, + 49.8993983, 63.4411227, 75.6467190583333, 96.69524329, 116.227155255 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(52.03215506, 57.5380954733333, + 65.0896034, 78.6313278, 90.8369241583333, 111.88544839, 131.417360355 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(50.33047826, 55.8364186733333, + 63.3879266, 76.929651, 89.1352473583333, 110.18377159, 129.715683555 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(31.64108436, 37.1470247733333, + 44.6985327, 58.2402571, 70.4458534583333, 91.49437769, 111.026289655 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(42.97084656, 48.4767869733333, + 56.0282949, 69.5700193, 81.7756156583333, 102.82413989, 122.356051855 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(74.060731605, 79.2556880033333, + 86.842200825, 100.02084865, 112.144647808333, 132.92181872, + 148.512935945), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(37.143801155, + 42.3387575533333, 49.925270375, 63.1039182, 75.2277173583333, + 96.00488827, 111.596005495), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(52.769249805, 57.9642062033333, 65.550719025, + 78.72936685, 90.8531660083333, 111.63033692, 127.221454145 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(50.589798605, 55.7847550033333, + 63.371267825, 76.54991565, 88.6737148083333, 109.45088572, + 125.042002945), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(32.047693155, + 37.2426495533333, 44.829162375, 58.0078102, 70.1316093583333, + 90.90878027, 106.499897495), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(44.088675405, 49.2836318033333, 56.870144625, + 70.04879245, 82.1725916083333, 102.94976252, 118.540879745 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(73.987476725, 79.38104865, + 86.39207555, 99.31687, 111.788622791667, 132.43595765, 144.92386215 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(37.437320425, 42.83089235, + 49.84191925, 62.7667137, 75.2384664916667, 95.88580135, 108.37370585 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(53.301934525, 58.69550645, + 65.70653335, 78.6313278, 91.1030805916667, 111.75041545, + 124.23831995), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.840787025, + 56.23435895, 63.24538585, 76.1701803, 88.6419330916667, 109.28926795, + 121.77717245), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(32.590131725, + 37.98370365, 44.99473055, 57.919525, 70.3912777916667, 91.03861265, + 103.52651715), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(45.198172325, + 50.59174425, 57.60277115, 70.5275656, 82.9993183916667, 103.64665325, + 116.13455775), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(75.956605975, + 80.9596484733333, 88.539361275, 100.167269, 112.632473483333, + 133.00282866, 140.02468224), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(38.155086225, 43.1581287233333, 50.737841525, + 62.36574925, 74.8309537333333, 95.20130891, 102.22316249 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(54.187905375, 59.1909478733333, + 66.770660675, 78.3985684, 90.8637728833333, 111.23412806, + 118.25598164), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(51.148701075, + 56.1517435733333, 63.731456375, 75.3593641, 87.8245685833333, + 108.19492376, 115.21677734), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(33.343987325, 38.3470298233333, 45.926742625, + 57.55465035, 70.0198548333333, 90.39021001, 97.41206359 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(48.042237525, 53.0452800233333, + 60.624992825, 72.25290055, 84.7181050333333, 105.08846021, + 112.11031379), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(77.149265375, + 82.22193559, 90.573646025, 101.0448836, 112.896123383333, + 132.884684393333, 140.681032895), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(38.069166575, 43.14183679, 51.493547225, 61.9647848, + 73.8160245833333, 93.8045855933333, 101.600934095), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(54.270190775, 59.34286099, 67.694571425, 78.165809, + 90.0170487833333, 110.005609793333, 117.801958295), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(50.652929675, 55.72559989, 64.077310325, 74.5485479, + 86.3997876833333, 106.388348693333, 114.184697195), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(33.658473375, 38.73114359, 47.082854025, 57.5540916, + 69.4053313833333, 89.3938923933333, 97.190240895), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(50.082617275, 55.15528749, 63.506997925, 73.9782355, + 85.8294752833333, 105.818036293333, 113.614384795), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(77.541498075, 82.84247276, 91.3108666166667, + 101.12743775, 112.919557791667, 132.597820013333, 138.915465815 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(38.111973675, 43.41294836, + 51.8813422166667, 61.69791335, 73.4900333916667, 93.1682956133333, + 99.485941415), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(53.630824525, + 58.93179921, 67.4001930666667, 77.2167642, 89.0088842416667, + 108.687146463333, 115.004792265), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(50.828888175, 56.12986286, 64.5982567166667, + 74.41482785, 86.2069478916667, 105.885210113333, 112.202855915 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(33.859192425, 39.16016711, + 47.6285609666667, 57.4451321, 69.2372521416667, 88.9155143633333, + 95.233160165), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.848687275, + 56.14966196, 64.6180558166667, 74.43462695, 86.2267469916667, + 105.905009213333, 112.222655015), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(76.872366945, 83.17028771, 91.1412068166667, + 101.2099919, 111.069035908333, 126.05282846, 137.02913753 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(37.093416945, 43.39133771, + 51.3622568166667, 61.4310419, 71.2900859083333, 86.2738784599999, + 97.25018753), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(51.930094445, + 58.22801521, 66.1989343166667, 76.2677194, 86.1267634083333, + 101.11055596, 112.08686503), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(49.943482845, 56.24140361, 64.2123227166667, + 74.2811078, 84.1401518083333, 99.1239443599999, 110.10025343 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(32.998547645, 39.29646841, + 47.2673875166667, 57.3361726, 67.1952166083333, 82.1790091599999, + 93.15531823), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.553393445, + 56.85131421, 64.8222333166667, 74.8910184, 84.7500624083333, + 99.7338549599999, 110.71016403), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(76.21678654, 82.90804183, 91.1486652083333, + 101.0448836, 111.104262633333, 123.740168563333, 137.39764222 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(36.60294484, 43.29420013, + 51.5348235083333, 61.4310419, 71.4904209333333, 84.1263268633333, + 97.78380052), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(51.43962234, + 58.13087763, 66.3715010083333, 76.2677194, 86.3270984333333, + 98.9630043633333, 112.62047802), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(49.45301074, 56.14426603, 64.3848894083333, + 74.2811078, 84.3404868333333, 96.9763927633333, 110.63386642 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(29.40244994, 36.09370523, + 44.3343286083333, 54.230547, 64.2899260333333, 76.9258319633333, + 90.58330562), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(49.15013844, + 55.84139373, 64.0820171083333, 73.9782355, 84.0376145333333, + 96.6735204633333, 110.33099412), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(73.774370035, 78.59141999, 88.0563121083333, + 97.9375799, 108.6317374, 121.075797326667, 135.25260137 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(37.267832035, 42.08488199, + 51.5497741083333, 61.4310419, 72.1251994, 84.5692593266667, + 98.74606337), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(52.104509535, + 56.92155949, 66.3864516083333, 76.2677194, 86.9618769, 99.4059368266667, + 113.58274087), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.117897935, + 54.93494789, 64.3998400083333, 74.2811078, 84.9752653, 97.4193252266667, + 111.59612927), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(28.359746035, + 33.17679599, 42.6416881083333, 52.5229559, 63.2171134, 75.6611733266667, + 89.83797737), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(46.364355735, + 51.18140569, 60.6462978083333, 70.5275656, 81.2217231, 93.6657830266667, + 107.84258707), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(69.34739278, + 72.7427495666667, 83.4242080833333, 93.4734845, 103.991254691667, + 116.04353109, 130.98286112), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(35.48943568, 38.8847924666667, 49.5662509833333, + 59.6155274, 70.1332975916667, 82.18557399, 97.12490402 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(51.17457578, 54.5699325666667, + 65.2513910833333, 75.3006675, 85.8184376916667, 97.87071409, + 112.81004412), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.15501608, + 53.5503728666667, 64.2318313833333, 74.2811078, 84.7988779916667, + 96.85115439, 111.79048442), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(26.99212458, 30.3874813666667, 41.0689398833333, + 51.1182163, 61.6359864916667, 73.68826289, 88.62759292 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(46.40147388, 49.7968306666667, + 60.4782891833333, 70.5275656, 81.0453357916667, 93.09761219, + 108.03694222), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(64.40363552, + 66.9533907966667, 77.5947525166667, 88.3355291, 98.9597954916667, + 111.033447776667, 126.36324447), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(32.34445442, 34.8942096966667, 45.5355714166667, + 56.276348, 66.9006143916667, 78.9742666766667, 94.30406337 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(49.28260942, 51.8323646966667, + 62.4737264166667, 73.214503, 83.8387693916667, 95.9124216766667, + 111.24221837), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.34921422, + 52.8989694966667, 63.5403312166667, 74.2811078, 84.9053741916667, + 96.9790264766667, 112.30882317), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(24.97919412, 27.5289493966667, 38.1703111166667, + 48.9110877, 59.5353540916667, 71.6090063766667, 86.93880307 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(45.63812572, 48.1878809966667, + 58.8292427166667, 69.5700193, 80.1942856916667, 92.2679379766667, + 107.59773467), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(58.360799175, + 61.0400563633333, 70.6001161083333, 82.4903292, 92.695819575, + 104.93632075, 121.19526997), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(30.782224175, 33.4614813633333, 43.0215411083333, + 54.9117542, 65.117244575, 77.35774575, 93.61669497), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(48.380692375, 51.0599495633333, + 60.6200093083333, 72.5102224, 82.715712775, 94.95621395, + 111.21516317), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.151577775, + 52.8308349633333, 62.3908947083333, 74.2811078, 84.486598175, + 96.72709935, 112.98604857), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(21.963138175, 24.6423953633333, 34.2024551083333, + 46.0926682, 56.298158575, 68.53865975, 84.79760897), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(45.329554075, 48.0088112633333, + 57.5688710083333, 69.4590841, 79.664574475, 91.90507565, + 108.16402487), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(51.08691667, + 53.3456512033333, 61.6880369333333, 75.3837738, 85.4781493083333, + 97.4282297266667, 112.904404715), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(30.05814807, 32.3168826033333, 40.6592683333333, + 54.3550052, 64.4493807083333, 76.3994611266667, 91.875636115 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(47.03156107, 49.2902956033333, + 57.6326813333333, 71.3284182, 81.4227937083333, 93.3728741266667, + 108.849049115), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(49.77812977, + 52.0368643033333, 60.3792500333333, 74.0749869, 84.1693624083333, + 96.1194428266667, 111.595617815), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(20.99789217, 23.2566267033333, 31.5990124333333, + 45.2947493, 55.3891248083333, 67.3392052266667, 82.815380215 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(44.94765487, 47.2063894033333, + 55.5487751333333, 69.244512, 79.3388875083333, 91.2889679266667, + 106.765142915), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(44.25108899, + 47.5210664066667, 55.509026825, 68.7398847, 79.2666461916667, + 90.27594772, 104.8739276), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(27.91791659, 31.1878940066667, 39.175854425, + 52.4067123, 62.9334737916667, 73.94277532, 88.5407552 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(45.53243499, 48.8024124066667, + 56.790372825, 70.0212307, 80.5479921916667, 91.55729372, + 106.1552736), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(46.78989109, + 50.0598685066667, 58.047828925, 71.2786868, 81.8054482916667, + 92.81474982, 107.4127297), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(19.74206179, 23.0120392066667, 30.999999625, + 44.2308575, 54.7576189916667, 65.76692052, 80.3649004 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(44.75571629, 48.0256937066667, + 56.013654125, 69.244512, 79.7712734916667, 90.78057502, 105.3785549 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(38.468745595, 41.4398087666667, + 49.05976785, 62.5379781, 73.1851803333333, 84.55503968, 96.5676217799999 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(28.211274595, 31.1823377666667, + 38.80229685, 52.2805071, 62.9277093333333, 74.29756868, 86.31015078 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(45.349091395, 48.3201545666667, + 55.94011365, 69.4183239, 80.0655261333333, 91.43538548, 103.44796758 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(45.705288595, 48.6763517666667, + 56.29631085, 69.7745211, 80.4217233333333, 91.79158268, 103.80416478 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(19.904592295, 22.8756554666667, + 30.49561455, 43.9738248, 54.6210270333333, 65.99088638, 78.00346848 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(44.197784295, 47.1688474666667, + 54.78880655, 68.2670168, 78.9142190333333, 90.28407838, 102.29666048 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(37.10558333, 41.02744724, + 47.4004852416667, 61.091556, 72.4254332, 84.1693834866667, + 92.43304734), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(27.86859183, + 31.79045574, 38.1634937416667, 51.8545645, 63.1884417, 74.9323919866667, + 83.19605584), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(43.92908563, + 47.85094954, 54.2239875416667, 67.9150583, 79.2489355, 90.9928857866667, + 99.25654964), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(44.82000173, + 48.74186564, 55.1149036416667, 68.8059744, 80.1398516, 91.8838018866667, + 100.14746574), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(19.83586753, + 23.75773144, 30.1307694416667, 43.8218402, 55.1557174, 66.8996676866667, + 75.16333154), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(44.01003133, + 47.93189524, 54.3049332416667, 67.996004, 79.3298812, 91.0738314866667, + 99.33749534), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(34.59870976, + 37.7426754566667, 43.8981963, 57.9203863, 68.6731234833333, + 80.3934972966666, 88.68986738), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(28.38696316, 31.5309288566667, 37.6864497, + 51.7086397, 62.4613768833333, 74.1817506966666, 82.47812078 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(44.22523506, 47.3692007566667, + 53.5247216, 67.5469116, 78.2996487833333, 90.0200225966666, + 98.31639268), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(44.42192546, + 47.5658911566667, 53.721412, 67.743602, 78.4963391833333, + 90.2167129966666, 98.51308308), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(20.43311166, 23.5770773566667, 29.7325982, + 43.7547882, 54.5075253833333, 66.2278991966666, 74.52426928 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(44.00579666, 47.1497623566667, + 53.3052832, 67.3274732, 78.0802103833333, 89.8005841966666, + 98.09695428), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(32.159838105, + 36.8239848966667, 42.5094393666667, 55.6730978, 67.0349863833333, + 78.6437884066667, 87.524143305), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(27.869349905, 32.5334966966667, 38.2189511666667, + 51.3826096, 62.7444981833333, 74.3533002066667, 83.233655105 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(43.014579205, 47.6787259966667, + 53.3641804666667, 66.5278389, 77.8897274833333, 89.4985295066667, + 98.378884405), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(42.988445205, + 47.6525919966667, 53.3380464666667, 66.5017049, 77.8635934833333, + 89.4723955066666, 98.352750405), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(19.978908105, 24.6430548966667, 30.3285093666667, + 43.4921678, 54.8540563833333, 66.4628584066666, 75.343213305 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(43.659974605, 48.3241213966667, + 54.0095758666667, 67.1732343, 78.5351228833333, 90.1439249066667, + 99.024279805), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(30.24830983, + 35.25638107, 41.7706605333333, 54.4077507, 66.117754675, + 76.0960279766667, 85.573087805), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(25.24463913, 30.25271037, 36.7669898333333, + 49.40408, 61.114083975, 71.0923572766667, 80.569417105 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(41.14124243, 46.14931367, + 52.6635931333333, 65.3006833, 77.010687275, 86.9889605766667, + 96.466020405), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(41.78522033, + 46.79329157, 53.3075710333333, 65.9446612, 77.654665175, + 87.6329384766667, 97.109998305), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(18.43758263, 23.44565387, 29.9599333333333, + 42.5970235, 54.307027475, 64.2853007766667, 73.762360605 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(42.68828603, 47.69635727, + 54.2106367333333, 66.8477269, 78.557730875, 88.5360041766667, + 98.013064005), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(30.19260489, + 34.7388982466667, 42.2121990666667, 53.3949649, 66.2985149166667, + 76.15698156, 81.22226177), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(25.24860779, 29.7949011466667, 37.2682019666667, + 48.4509678, 61.3545178166667, 71.21298446, 76.27826467 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(41.03389919, 45.5801925466667, + 53.0534933666667, 64.2362592, 77.1398092166667, 86.99827586, + 92.06355607), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(42.64995319, + 47.1962465466667, 54.6695473666667, 65.8523132, 78.7558632166667, + 88.61432986, 93.67961007), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(18.77219739, 23.3184907466667, 30.7917915666667, + 41.9745574, 54.8781074166667, 64.73657406, 69.80185427 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(41.42276969, 45.9690630466667, + 53.4423638666667, 64.6251297, 77.5286797166667, 87.38714636, + 92.45242657), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(30.22683433, + 34.9465693766667, 42.3338884, 52.1648167, 66.3757032333333, + 76.0204502733333, 80.92708679), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(26.48997923, 31.2097142766667, 38.5970333, + 48.4279616, 62.6388481333333, 72.2835951733333, 77.19023169 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(39.87597843, 44.5957134766667, + 51.9830325, 61.8139608, 76.0248473333333, 85.6695943733333, + 90.57623089), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(41.89523223, + 46.6149672766667, 54.0022863, 63.8332146, 78.0441011333333, + 87.6888481733333, 92.59548469), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(18.89110323, 23.6108382766667, 30.9981573, + 40.8290856, 55.0399721333333, 64.6847191733333, 69.59135569 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(42.00742563, 46.7271606766667, + 54.1144797, 63.945408, 78.1562945333333, 87.8010415733333, + 92.70767809), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(29.53863982, + 33.1954511766667, 41.0448188583333, 50.5057495, 64.8038051083333, + 73.5802344266667, 78.079860825), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(26.31251602, 29.9693273766667, 37.8186950583333, + 47.2796257, 61.5776813083333, 70.3541106266667, 74.853737025 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(37.32278042, 40.9795917766667, + 48.8289594583333, 58.2898901, 72.5879457083334, 81.3643750266667, + 85.864001425), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(42.11476082, + 45.7715721766667, 53.6209398583333, 63.0818705, 77.3799261083334, + 86.1563554266667, 90.655981825), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(19.43507812, 23.0918894766667, 30.9412571583333, + 40.4021878, 54.7002434083333, 63.4766727266667, 67.976299125 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(41.11478092, 44.7715922766667, + 52.6209599583333, 62.0818906, 76.3799462083334, 85.1563755266667, + 89.656001925), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr"))), class = c("distribution", + "vctrs_vctr", "list"))), row.names = c(NA, -186L), class = c("tbl_df", + "tbl", "data.frame")) + diff --git a/tests/testthat/test-climatological_forecaster.R b/tests/testthat/test-climatological_forecaster.R index 3bee1319..16f31140 100644 --- a/tests/testthat/test-climatological_forecaster.R +++ b/tests/testthat/test-climatological_forecaster.R @@ -24,5 +24,3 @@ test_that("climate args list validates properly", { expect_snapshot(error = TRUE, climate_args_list(quantile_by_key = TRUE)) expect_snapshot(error = TRUE, climate_args_list(quantile_by_key = 2:3)) }) - - diff --git a/tests/testthat/test-snapshots.R b/tests/testthat/test-snapshots.R index 3aecfd6b..505ad518 100644 --- a/tests/testthat/test-snapshots.R +++ b/tests/testthat/test-snapshots.R @@ -183,3 +183,31 @@ test_that("arx_classifier snapshots", { class = "epipredict__arx_classifier__adjust_latency_unsupported_method" ) }) + +test_that("climatological_forecaster snapshots", { + rates <- cases_deaths_subset + + # set as_of to the last day in the data + attr(rates, "metadata")$as_of <- as.Date("2021-12-31") + fcast <- climatological_forecaster(rates, "case_rate_7d_av") + expect_snapshot_tibble(fcast$predictions) + + # Compute quantiles separately by location, and a backcast + backcast <- climatological_forecaster( + rates, "case_rate_7d_av", + climate_args_list( + quantile_by_key = "geo_value", + forecast_date = as.Date("2021-06-01") + ) + ) + expect_snapshot_tibble(backcast$predictions) + # compute the climate "daily" rather than "weekly" + # use a two week window (on both sides) + daily_fcast <- climatological_forecaster( + rates, "case_rate_7d_av", + climate_args_list( + time_type = "day", window_size = 14L, forecast_horizon = 0:30 + ) + ) + expect_snapshot_tibble(daily_fcast$predictions) +}) From 83e0ad7e5c3373bee7d745a3ebcfcec5d2890fcb Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 10:07:06 -0800 Subject: [PATCH 28/54] redocument, add news --- NAMESPACE | 3 --- NEWS.md | 2 ++ R/climatological_forecaster.R | 4 ++-- man/climate_args_list.Rd | 10 +++++----- man/climatological_forecaster.Rd | 27 +++++++++++++++++++++++++-- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 2723e1f0..d015bd3f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -278,9 +278,6 @@ importFrom(glue,glue) importFrom(hardhat,extract_recipe) importFrom(hardhat,refresh_blueprint) importFrom(hardhat,run_mold) -importFrom(lubridate,epiweek) -importFrom(lubridate,epiyear) -importFrom(lubridate,ymd) importFrom(magrittr,"%>%") importFrom(magrittr,extract2) importFrom(recipes,bake) diff --git a/NEWS.md b/NEWS.md index ed44c346..ce990555 100644 --- a/NEWS.md +++ b/NEWS.md @@ -20,6 +20,8 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.0.x will indicat - Make key column inference more consistent within the package and with current `epiprocess`. - Fix `quantile_reg()` producing error when asked to output just median-level predictions. - (temporary) ahead negative is allowed for `step_epi_ahead` until we have `step_epi_shift` +- Add `step_climate()` to create "climate" predictor in forecast workflows +- Add `climatological_forecaster()` to automatically create climate baselines ## Bug fixes diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index 65f36f33..af4e090b 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -183,7 +183,7 @@ climatological_forecaster <- function(epi_data, #' Climatological forecaster argument constructor #' #' @inheritParams epi_recipe -#' @param prediction_horizon Vector of integers giving the number of time steps, +#' @param forecast_horizon Vector of integers giving the number of time steps, #' in units of the `time_type`, #' from the `reference_date` for which predictions should be produced. #' @inheritParams step_climate @@ -191,7 +191,7 @@ climatological_forecaster <- function(epi_data, #' #' @return A list containing updated parameter choices with class `climate_alist`. #' @export -#' @seealso [climatological_predictor()], [step_climate()] +#' @seealso [climatological_forecaster()], [step_climate()] #' #' @examples #' climate_args_list() diff --git a/man/climate_args_list.Rd b/man/climate_args_list.Rd index 3216d098..3a889e5c 100644 --- a/man/climate_args_list.Rd +++ b/man/climate_args_list.Rd @@ -27,6 +27,10 @@ adjustment (the default case), or non-\code{NULL}. }} +\item{forecast_horizon}{Vector of integers giving the number of time steps, +in units of the \code{time_type}, +from the \code{reference_date} for which predictions should be produced.} + \item{time_type}{The duration over which time aggregation should be performed.} \item{center_method}{The measure of center to be calculated over the time @@ -59,10 +63,6 @@ residual quantiles are used. It is not applicable with \item{...}{Further arguments passed to or from other methods (not currently used).} - -\item{prediction_horizon}{Vector of integers giving the number of time steps, -in units of the \code{time_type}, -from the \code{reference_date} for which predictions should be produced.} } \value{ A list containing updated parameter choices with class \code{climate_alist}. @@ -79,5 +79,5 @@ climate_args_list( } \seealso{ -\code{\link[=climatological_predictor]{climatological_predictor()}}, \code{\link[=step_climate]{step_climate()}} +\code{\link[=climatological_forecaster]{climatological_forecaster()}}, \code{\link[=step_climate]{step_climate()}} } diff --git a/man/climatological_forecaster.Rd b/man/climatological_forecaster.Rd index 64dff04c..26923c9a 100644 --- a/man/climatological_forecaster.Rd +++ b/man/climatological_forecaster.Rd @@ -31,9 +31,32 @@ The forecast is taken as the quantiles of the \code{outcome} in a small window around the target period, computed over the entire available history. } \examples{ +rates <- cases_deaths_subset +# set as_of to the last day in the data +attr(rates, "metadata")$as_of <- as.Date("2021-12-31") +fcast <- climatological_forecaster(rates, "case_rate_7d_av") +autoplot(fcast) -1 + 1 -2 + 2 +# Compute quantiles separately by location, and a backcast +backcast <- climatological_forecaster( + rates, "case_rate_7d_av", + climate_args_list( + quantile_by_key = "geo_value", + forecast_date = as.Date("2021-06-01") + ) +) +autoplot(backcast) + +# compute the climate "daily" rather than "weekly" +# use a two week window (on both sides) +daily_fcast <- climatological_forecaster( + rates, "case_rate_7d_av", + climate_args_list( + time_type = "day", window_size = 14L, forecast_horizon = 0:30 + ) +) +autoplot(daily_fcast) + + ggplot2::coord_cartesian(xlim = c(as.Date("2021-10-01"), NA)) } \seealso{ \code{\link[=step_climate]{step_climate()}} From d56d488d394213baec1413831c7509abfba12b93 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 12:04:38 -0800 Subject: [PATCH 29/54] prefix with recipes, aside to rename object --- R/step_adjust_latency.R | 14 +++++++------- man/step_adjust_latency.Rd | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/R/step_adjust_latency.R b/R/step_adjust_latency.R index 7ce64b30..cfe0ffec 100644 --- a/R/step_adjust_latency.R +++ b/R/step_adjust_latency.R @@ -180,22 +180,22 @@ #' @rdname step_adjust_latency #' @export #' @examples -#' jhu <- covid_case_death_rates %>% +#' rates <- covid_case_death_rates %>% #' dplyr::filter(time_value > "2021-11-01", geo_value %in% c("ak", "ca", "ny")) #' # setting the `as_of` to something realistic -#' attributes(jhu)$metadata$as_of <- max(jhu$time_value) + 3 +#' attributes(rates)$metadata$as_of <- max(rates$time_value) + 3 #' -#' r <- epi_recipe(covid_case_death_rates) %>% -#' step_adjust_latency(has_role("raw"), method = "extend_ahead") %>% +#' r <- epi_recipe(rates) %>% +#' step_adjust_latency(recipes::has_role("raw"), method = "extend_ahead") %>% #' step_epi_ahead(death_rate, ahead = 7) %>% #' step_epi_lag(death_rate, lag = c(0, 7, 14)) #' r #' -#' jhu_fit <- epi_workflow() %>% +#' rates_fit <- epi_workflow() %>% #' add_epi_recipe(r) %>% #' add_model(linear_reg()) %>% -#' fit(data = jhu) -#' jhu_fit +#' fit(data = rates) +#' rates_fit #' #' @importFrom recipes detect_step #' @importFrom rlang enquos is_empty diff --git a/man/step_adjust_latency.Rd b/man/step_adjust_latency.Rd index 1493898b..75d67447 100644 --- a/man/step_adjust_latency.Rd +++ b/man/step_adjust_latency.Rd @@ -277,22 +277,22 @@ If you create columns that you then apply lags to (such as } \examples{ -jhu <- covid_case_death_rates \%>\% +rates <- covid_case_death_rates \%>\% dplyr::filter(time_value > "2021-11-01", geo_value \%in\% c("ak", "ca", "ny")) # setting the `as_of` to something realistic -attributes(jhu)$metadata$as_of <- max(jhu$time_value) + 3 +attributes(rates)$metadata$as_of <- max(rates$time_value) + 3 -r <- epi_recipe(covid_case_death_rates) \%>\% - step_adjust_latency(has_role("raw"), method = "extend_ahead") \%>\% +r <- epi_recipe(rates) \%>\% + step_adjust_latency(recipes::has_role("raw"), method = "extend_ahead") \%>\% step_epi_ahead(death_rate, ahead = 7) \%>\% step_epi_lag(death_rate, lag = c(0, 7, 14)) r -jhu_fit <- epi_workflow() \%>\% +rates_fit <- epi_workflow() \%>\% add_epi_recipe(r) \%>\% add_model(linear_reg()) \%>\% - fit(data = jhu) -jhu_fit + fit(data = rates) +rates_fit } \seealso{ From c1cf5ba821134f861b8bbc387bd2cd684b8097c2 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 12:05:02 -0800 Subject: [PATCH 30/54] muffle dplyr select warnings --- R/climatological_forecaster.R | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index af4e090b..061ee658 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -78,8 +78,10 @@ climatological_forecaster <- function(epi_data, )) } # process the time types - epi_data <- epi_data[!is.na(epi_data[outcome]), ] %>% - select(key_colnames(epi_data), outcome) + sym_outcome <- sym(outcome) + epi_data <- epi_data %>% + filter(!is.na(!!outcome)) %>% + select(all_of(c(key_colnames(epi_data), outcome))) if (time_type %in% c("week", "epiweek")) { ttype_dur <- lubridate::weeks time_aggr <- ifelse(time_type == "week", lubridate::epiweek, lubridate::isoweek) @@ -99,15 +101,14 @@ climatological_forecaster <- function(epi_data, median = function(x, w) stats::median(x, na.rm = TRUE) ) # get the point predictions - sym_outcome <- sym(outcome) keys <- key_colnames(epi_data, exclude = "time_value") epi_data <- epi_data %>% mutate(.idx = time_aggr(time_value), .weights = 1) climate_center <- epi_data %>% - select(.idx, .weights, outcome, all_of(keys)) %>% + select(.idx, .weights, all_of(c(outcome, keys))) %>% dplyr::reframe( roll_modular_multivec(!!sym_outcome, .idx, .weights, center_fn, window_size, modulus), - .by = keys + .by = all_of(keys) ) %>% rename(.pred = climate_pred) # get the quantiles @@ -119,11 +120,11 @@ climatological_forecaster <- function(epi_data, ))) } climate_quantiles <- epi_data %>% - select(.idx, .weights, outcome, all_of(args_list$quantile_by_key)) %>% + select(.idx, .weights, all_of(c(outcome, args_list$quantile_by_key))) %>% dplyr::reframe( roll_modular_multivec(!!sym_outcome, .idx, .weights, Quantile, window_size, modulus), - .by = args_list$quantile_by_key + .by = all_of(args_list$quantile_by_key) ) %>% rename(.pred_distn = climate_pred) %>% mutate(.pred_distn = dist_quantiles(.pred_distn, args_list$quantile_levels)) @@ -158,7 +159,7 @@ climatological_forecaster <- function(epi_data, ewf <- epi_workflow() ewf$trained <- TRUE ewf$pre <- list(mold = list( - outcomes = select(epi_data, outcome), + outcomes = select(epi_data, !!sym_outcome), extras = list(roles = list( geo_value = select(epi_data, geo_value), time_value = select(epi_data, time_value) From 4a348c8b91b6d50ddbfed14def6b878c06a6200e Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 12:05:49 -0800 Subject: [PATCH 31/54] shifting must happen before joining to avoid duplicated rows --- R/step_climate.R | 17 ++++++++--------- tests/testthat/test-step_climate.R | 9 +++++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/R/step_climate.R b/R/step_climate.R index 01762b75..cade124a 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -165,7 +165,7 @@ step_climate <- arg_is_lgl_scalar(skip) time_aggr <- switch(time_type, - epiweek = lubridate::epiweek, week = lubridate::week, + epiweek = lubridate::epiweek, week = lubridate::isoweek, month = lubridate::month, day = lubridate::yday) recipes::add_step( @@ -243,11 +243,15 @@ prep.step_climate <- function(x, training, info = NULL, ...) { modulus <- switch(x$time_type, epiweek = 53L, week = 53L, month = 12L, day = 365L) fn <- switch(x$center_method, - mean = function(x, w) weighted.mean(x, w, na.rm = TRUE), + mean = function(x, w) stats::weighted.mean(x, w, na.rm = TRUE), median = function(x, w) median(x, na.rm = TRUE)) climate_table <- training %>% - mutate(.idx = x$time_aggr(time_value), .weights = wts) %>% + mutate( + .idx = x$time_aggr(time_value), .weights = wts, + .idx = (.idx - x$forecast_ahead) %% modulus, + .idx = dplyr::case_when(.idx == 0 ~ modulus, TRUE ~ .idx) + ) %>% select(.idx, .weights, all_of(c(col_names, x$epi_keys))) %>% tidyr::pivot_longer(all_of(unname(col_names))) %>% dplyr::reframe( @@ -279,14 +283,9 @@ prep.step_climate <- function(x, training, info = NULL, ...) { } - #' @export bake.step_climate <- function(object, new_data, ...) { - climate_table <- object$climate_table %>% - mutate( - .idx = (.idx - object$forecast_ahead) %% object$modulus, - .idx = dplyr::case_when(.idx == 0 ~ object$modulus, TRUE ~ .idx) - ) + climate_table <- object$climate_table new_data %>% mutate(.idx = object$time_aggr(time_value)) %>% left_join(climate_table, by = c(".idx", object$epi_keys)) %>% diff --git a/tests/testthat/test-step_climate.R b/tests/testthat/test-step_climate.R index ab71aa98..b42a9668 100644 --- a/tests/testthat/test-step_climate.R +++ b/tests/testthat/test-step_climate.R @@ -99,7 +99,12 @@ test_that("leading the climate predictor works as expected", { step_epi_naomit() p <- prep(r, x) - expected_res <- tibble(.idx = 1:53, climate_y = c(2, 2:25, 25, 25, 25:2, 2, 2)) + expected_res <- tibble(.idx = 1:53, climate_y = c(2, 2:25, 25, 25, 25:2, 2, 2)) %>% + mutate( + .idx = (.idx - 2L) %% 53, + .idx = dplyr::case_when(.idx == 0 ~ 53L, TRUE ~ .idx) + ) %>% + arrange(.idx) expect_equal(p$steps[[3]]$climate_table, expected_res) b <- bake(p, new_data = NULL) @@ -107,7 +112,7 @@ test_that("leading the climate predictor works as expected", { # expected climate predictor should be shifted forward by 2 weeks expected_climate_pred <- x %>% mutate( - .idx = (lubridate::epiweek(time_value) + 2) %% 53, + .idx = lubridate::epiweek(time_value) %% 53, .idx = dplyr::case_when(.idx == 0 ~ 53, TRUE ~ .idx) ) %>% left_join(expected_res, by = join_by(.idx)) %>% From 46b2a2e99d77a480003ba4547cf63f11d6d80eb2 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 12:21:33 -0800 Subject: [PATCH 32/54] ignore renviron --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index dd821f77..ae7df412 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ inst/doc .Rprofile renv.lock renv/ +.Renviron From 5f76be3ebf3e3966a60a72260944beee74b213fc Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 12:21:55 -0800 Subject: [PATCH 33/54] months is in base, so we ensure we use lubridate --- R/climatological_forecaster.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index 061ee658..2bf5e089 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -87,7 +87,7 @@ climatological_forecaster <- function(epi_data, time_aggr <- ifelse(time_type == "week", lubridate::epiweek, lubridate::isoweek) modulus <- 53L } else if (time_type == "month") { - ttype_dur <- lubridate::months + ttype_dur <- function(x) lubridate::period(month = x) time_aggr <- lubridate::month modulus <- 12L } else if (time_type == "day") { From 77dbcc40830b807aafa9f41d5efae6b4fec9e045 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 12:33:55 -0800 Subject: [PATCH 34/54] rebuild readme --- README.md | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 5293a0e9..1f24bab2 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ covid_case_death_rates #> An `epi_df` object, 20,496 x 4 with metadata: #> * geo_type = state #> * time_type = day -#> * as_of = 2022-05-31 12:08:25.791826 +#> * as_of = 2023-03-10 #> #> # A tibble: 20,496 × 4 #> geo_value time_value case_rate death_rate @@ -88,11 +88,11 @@ covid_case_death_rates #> 3 ar 2020-12-31 66.0 1.27 #> 4 as 2020-12-31 0 0 #> 5 az 2020-12-31 76.8 1.10 -#> 6 ca 2020-12-31 96.0 0.751 -#> 7 co 2020-12-31 35.8 0.649 +#> 6 ca 2020-12-31 95.9 0.755 +#> 7 co 2020-12-31 37.8 0.376 #> 8 ct 2020-12-31 52.1 0.819 #> 9 dc 2020-12-31 31.0 0.601 -#> 10 de 2020-12-31 65.2 0.807 +#> 10 de 2020-12-31 64.3 0.912 #> # ℹ 20,486 more rows ``` @@ -113,19 +113,20 @@ two_week_ahead <- arx_forecaster( two_week_ahead #> ══ A basic forecaster of type ARX Forecaster ═══════════════════════════════ #> -#> This forecaster was fit on 2024-11-11 11:38:31. +#> This forecaster was fit on 2025-02-11 12:32:56. #> #> Training data was an with: #> • Geography: state, #> • Time type: day, -#> • Using data up-to-date as of: 2022-05-31 12:08:25. +#> • Using data up-to-date as of: 2023-03-10. +#> • With the last data available on 2021-12-31 #> #> ── Predictions ───────────────────────────────────────────────────────────── #> #> A total of 56 predictions are available for #> • 56 unique geographic regions, #> • At forecast date: 2021-12-31, -#> • For target date: 2022-01-14. +#> • For target date: 2022-01-14, #> ``` @@ -161,11 +162,11 @@ two_week_ahead$epi_workflow #> #> Coefficients: #> (Intercept) lag_0_case_rate lag_1_case_rate lag_2_case_rate -#> -0.0073358 0.0030365 0.0012467 0.0009536 +#> -0.0071026 0.0040340 0.0007863 0.0003699 #> lag_3_case_rate lag_7_case_rate lag_14_case_rate lag_0_death_rate -#> 0.0011425 0.0012481 0.0003041 0.1351769 +#> 0.0012887 0.0011980 0.0002527 0.1348573 #> lag_7_death_rate lag_14_death_rate -#> 0.1471127 0.1062473 +#> 0.1479274 0.1067074 #> #> ── Postprocessor ─────────────────────────────────────────────────────────── #> @@ -188,16 +189,16 @@ two_week_ahead$predictions #> # A tibble: 56 × 5 #> geo_value .pred .pred_distn forecast_date target_date #> -#> 1 ak 0.449 quantiles(0.45)[2] 2021-12-31 2022-01-14 -#> 2 al 0.574 quantiles(0.57)[2] 2021-12-31 2022-01-14 -#> 3 ar 0.673 quantiles(0.67)[2] 2021-12-31 2022-01-14 -#> 4 as 0 quantiles(0.12)[2] 2021-12-31 2022-01-14 -#> 5 az 0.679 quantiles(0.68)[2] 2021-12-31 2022-01-14 -#> 6 ca 0.575 quantiles(0.57)[2] 2021-12-31 2022-01-14 -#> 7 co 0.862 quantiles(0.86)[2] 2021-12-31 2022-01-14 -#> 8 ct 1.07 quantiles(1.07)[2] 2021-12-31 2022-01-14 -#> 9 dc 2.12 quantiles(2.12)[2] 2021-12-31 2022-01-14 -#> 10 de 1.09 quantiles(1.09)[2] 2021-12-31 2022-01-14 +#> 1 ak 0.450 quantiles(0.45)[7] 2021-12-31 2022-01-14 +#> 2 al 0.602 quantiles(0.6)[7] 2021-12-31 2022-01-14 +#> 3 ar 0.694 quantiles(0.69)[7] 2021-12-31 2022-01-14 +#> 4 as 0 quantiles(0)[7] 2021-12-31 2022-01-14 +#> 5 az 0.699 quantiles(0.7)[7] 2021-12-31 2022-01-14 +#> 6 ca 0.592 quantiles(0.59)[7] 2021-12-31 2022-01-14 +#> 7 co 1.47 quantiles(1.47)[7] 2021-12-31 2022-01-14 +#> 8 ct 1.08 quantiles(1.08)[7] 2021-12-31 2022-01-14 +#> 9 dc 2.14 quantiles(2.14)[7] 2021-12-31 2022-01-14 +#> 10 de 1.13 quantiles(1.13)[7] 2021-12-31 2022-01-14 #> # ℹ 46 more rows ``` From c98b47cc11bb869370c3321d6cdf5db547c2b734 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 12:35:51 -0800 Subject: [PATCH 35/54] satisfy styler --- R/climatological_forecaster.R | 56 +++++++++++++++++------------- R/step_adjust_latency.R | 3 +- R/step_climate.R | 25 +++++++++---- tests/testthat/test-step_climate.R | 16 +++++---- 4 files changed, 61 insertions(+), 39 deletions(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index 2bf5e089..8de21b3f 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -95,8 +95,7 @@ climatological_forecaster <- function(epi_data, time_aggr <- lubridate::yday modulus <- 365L } - center_fn <- switch( - args_list$center_method, + center_fn <- switch(args_list$center_method, mean = function(x, w) mean(x, na.rm = TRUE), median = function(x, w) stats::median(x, na.rm = TRUE) ) @@ -106,8 +105,10 @@ climatological_forecaster <- function(epi_data, climate_center <- epi_data %>% select(.idx, .weights, all_of(c(outcome, keys))) %>% dplyr::reframe( - roll_modular_multivec(!!sym_outcome, .idx, .weights, center_fn, window_size, - modulus), + roll_modular_multivec( + !!sym_outcome, .idx, .weights, center_fn, window_size, + modulus + ), .by = all_of(keys) ) %>% rename(.pred = climate_pred) @@ -116,14 +117,17 @@ climatological_forecaster <- function(epi_data, x <- x - stats::median(x, na.rm = TRUE) if (args_list$symmetrize) x <- c(x, -x) list(unname(quantile( - x, probs = args_list$quantile_levels, na.rm = TRUE, type = 8 + x, + probs = args_list$quantile_levels, na.rm = TRUE, type = 8 ))) } climate_quantiles <- epi_data %>% select(.idx, .weights, all_of(c(outcome, args_list$quantile_by_key))) %>% dplyr::reframe( - roll_modular_multivec(!!sym_outcome, .idx, .weights, Quantile, window_size, - modulus), + roll_modular_multivec( + !!sym_outcome, .idx, .weights, Quantile, window_size, + modulus + ), .by = all_of(args_list$quantile_by_key) ) %>% rename(.pred_distn = climate_pred) %>% @@ -138,12 +142,13 @@ climatological_forecaster <- function(epi_data, dplyr::distinct() %>% mutate(forecast_date = forecast_date, .idx = time_aggr(forecast_date)) predictions <- map(horizon, ~ { - predictions %>% - mutate(.idx = .idx + .x, target_date = forecast_date + ttype_dur(.x)) - }) %>% + predictions %>% + mutate(.idx = .idx + .x, target_date = forecast_date + ttype_dur(.x)) + }) %>% purrr::list_rbind() %>% - mutate(.idx = .idx %% modulus, - .idx = dplyr::case_when(.idx == 0 ~ modulus, TRUE ~ .idx) + mutate( + .idx = .idx %% modulus, + .idx = dplyr::case_when(.idx == 0 ~ modulus, TRUE ~ .idx) ) %>% left_join(climate_table, by = c(".idx", keys)) %>% select(-.idx) @@ -167,16 +172,18 @@ climatological_forecaster <- function(epi_data, )) other_keys <- key_colnames(epi_data, exclude = c("time_value", "geo_value")) if (length(other_keys) > 0) { - ewf$pre$mold$extras$roles$key = epi_data %>% select(all_of(other_keys)) + ewf$pre$mold$extras$roles$key <- epi_data %>% select(all_of(other_keys)) } - structure(list( - predictions = predictions, - epi_workflow = ewf, - metadata = list( - training = attr(epi_data, "metadata"), - forecast_created = Sys.time() - )), + structure( + list( + predictions = predictions, + epi_workflow = ewf, + metadata = list( + training = attr(epi_data, "metadata"), + forecast_created = Sys.time() + ) + ), class = c("climate_fcast", "canned_epipred") ) } @@ -212,7 +219,6 @@ climate_args_list <- function( nonneg = TRUE, quantile_by_key = character(0L), ...) { - rlang::check_dots_empty() time_type <- arg_match(time_type) center_method <- rlang::arg_match(center_method) @@ -226,9 +232,11 @@ climate_args_list <- function( arg_is_probabilities(quantile_levels) quantile_levels <- sort(unique(c(0.5, quantile_levels))) - structure(enlist( - forecast_date, forecast_horizon, time_type, center_method, window_size, - quantile_levels, symmetrize, nonneg, quantile_by_key), + structure( + enlist( + forecast_date, forecast_horizon, time_type, center_method, window_size, + quantile_levels, symmetrize, nonneg, quantile_by_key + ), class = c("climate_fcast", "alist") ) } diff --git a/R/step_adjust_latency.R b/R/step_adjust_latency.R index cfe0ffec..ae9db6ef 100644 --- a/R/step_adjust_latency.R +++ b/R/step_adjust_latency.R @@ -360,5 +360,6 @@ print.step_adjust_latency <- } title <- trimws(paste("Adj.", x$method)) print_epi_step(x$columns, x$terms, x$trained, title, - conjunction = conj, extra_text = extra_text) + conjunction = conj, extra_text = extra_text + ) } diff --git a/R/step_climate.R b/R/step_climate.R index cade124a..2f88ca94 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -92,8 +92,10 @@ #' # same idea, but using weekly climate #' r <- epi_recipe(covid_case_death_rates) %>% #' step_epi_ahead(death_rate, ahead = 7) %>% -#' step_climate(death_rate, forecast_ahead = 1, time_type = "epiweek", -#' window_size = 1L) +#' step_climate(death_rate, +#' forecast_ahead = 1, time_type = "epiweek", +#' window_size = 1L +#' ) #' r #' #' r %>% @@ -165,8 +167,11 @@ step_climate <- arg_is_lgl_scalar(skip) time_aggr <- switch(time_type, - epiweek = lubridate::epiweek, week = lubridate::isoweek, - month = lubridate::month, day = lubridate::yday) + epiweek = lubridate::epiweek, + week = lubridate::isoweek, + month = lubridate::month, + day = lubridate::yday + ) recipes::add_step( recipe, @@ -240,11 +245,17 @@ prep.step_climate <- function(x, training, info = NULL, ...) { wts_used <- !is.null(wts) wts <- wts %||% rep(1, nrow(training)) - modulus <- switch(x$time_type, epiweek = 53L, week = 53L, month = 12L, day = 365L) + modulus <- switch(x$time_type, + epiweek = 53L, + week = 53L, + month = 12L, + day = 365L + ) fn <- switch(x$center_method, - mean = function(x, w) stats::weighted.mean(x, w, na.rm = TRUE), - median = function(x, w) median(x, na.rm = TRUE)) + mean = function(x, w) stats::weighted.mean(x, w, na.rm = TRUE), + median = function(x, w) median(x, na.rm = TRUE) + ) climate_table <- training %>% mutate( diff --git a/tests/testthat/test-step_climate.R b/tests/testthat/test-step_climate.R index b42a9668..04578948 100644 --- a/tests/testthat/test-step_climate.R +++ b/tests/testthat/test-step_climate.R @@ -6,12 +6,12 @@ test_that("roll_modular_multivec works", { ) modulus <- 3L - Mean = function(x, w) weighted.mean(x, w, na.rm = TRUE) - Median = function(x, w) median(x, na.rm = TRUE) + Mean <- function(x, w) weighted.mean(x, w, na.rm = TRUE) + Median <- function(x, w) median(x, na.rm = TRUE) # unweighted mean expected_res <- tib |> - mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus ) |> + mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus) |> summarise(climate_pred = weighted.mean(col, w = w), .by = .idx) expect_equal( roll_modular_multivec(tib$col, tib$.idx, tib$w, Mean, 0, modulus), @@ -26,7 +26,7 @@ test_that("roll_modular_multivec works", { # weighted mean tib$w <- c(1, 2, 3, 1, 2, 1, 1, 2, 2, 1) expected_res <- tib |> - mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus ) |> + mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus) |> summarise(climate_pred = weighted.mean(col, w = w), .by = .idx) expect_equal( roll_modular_multivec(tib$col, tib$.idx, tib$w, Mean, 0, modulus), @@ -43,7 +43,7 @@ test_that("roll_modular_multivec works", { ) # median expected_res <- tib |> - mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus ) |> + mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus) |> summarise(climate_pred = median(col), .by = .idx) expect_equal( roll_modular_multivec(tib$col, tib$.idx, tib$w, Median, 0, modulus), @@ -125,7 +125,9 @@ test_that("leading the climate predictor works as expected", { td <- get_test_data(r, x) expected_test_x <- td %>% filter(time_value == "2021-12-31") %>% - mutate(ahead_14_y = NA_real_, lag_0_y = 1, lag_7_y = 2, lag_14_y = 3, - climate_y = 2) + mutate( + ahead_14_y = NA_real_, lag_0_y = 1, lag_7_y = 2, lag_14_y = 3, + climate_y = 2 + ) expect_equal(bake(p, td), expected_test_x) }) From 48ea5ca7b149989ac365504307f9ad5070e9fc08 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Tue, 11 Feb 2025 16:29:25 -0800 Subject: [PATCH 36/54] add a print method --- NAMESPACE | 1 + R/canned-epipred.R | 62 ++++++++++++++++++----------------- R/climatological_forecaster.R | 8 +++++ man/step_climate.Rd | 6 ++-- 4 files changed, 45 insertions(+), 32 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index d015bd3f..eb835105 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -74,6 +74,7 @@ S3method(print,arx_fcast) S3method(print,canned_epipred) S3method(print,cdc_baseline_fcast) S3method(print,check_enough_train_data) +S3method(print,climate_fcast) S3method(print,epi_recipe) S3method(print,epi_workflow) S3method(print,flat_fcast) diff --git a/R/canned-epipred.R b/R/canned-epipred.R index 8a5baa58..48e98416 100644 --- a/R/canned-epipred.R +++ b/R/canned-epipred.R @@ -112,37 +112,39 @@ print.canned_epipred <- function(x, name, ...) { "At forecast date{?s}: {.val {fds}},", "For target date{?s}: {.val {tds}}," )) - fit_recipe <- extract_recipe(x$epi_workflow) - if (detect_step(fit_recipe, "adjust_latency")) { - is_adj_latency <- map_lgl(fit_recipe$steps, function(x) inherits(x, "step_adjust_latency")) - latency_step <- fit_recipe$steps[is_adj_latency][[1]] - # all steps after adjust_latency - later_steps <- fit_recipe$steps[-(1:which(is_adj_latency))] - if (latency_step$method == "extend_ahead") { - step_names <- "step_epi_ahead" - type_str <- "Aheads" - } else if (latency_step$method == "extend_lags") { - step_names <- "step_epi_lag" - type_str <- "Lags" - } else { - step_names <- "" - type_str <- "columns locf" - } - later_steps[[1]]$columns - valid_columns <- later_steps %>% - keep(function(x) inherits(x, step_names)) %>% - purrr::map("columns") %>% - reduce(c) - latency_per_base_col <- latency_step$latency_table %>% - filter(col_name %in% valid_columns) %>% - mutate(latency = abs(latency)) - if (latency_step$method != "locf" && nrow(latency_per_base_col) > 1) { - intro_text <- glue::glue("{type_str} adjusted per column: ") - } else if (latency_step$method != "locf") { - intro_text <- glue::glue("{type_str} adjusted for ") + if ("actions" %in% names(x$pre) && "recipe" %in% names(x$pre$actions)) { + fit_recipe <- extract_recipe(x$epi_workflow) + if (detect_step(fit_recipe, "adjust_latency")) { + is_adj_latency <- map_lgl(fit_recipe$steps, function(x) inherits(x, "step_adjust_latency")) + latency_step <- fit_recipe$steps[is_adj_latency][[1]] + # all steps after adjust_latency + later_steps <- fit_recipe$steps[-(1:which(is_adj_latency))] + if (latency_step$method == "extend_ahead") { + step_names <- "step_epi_ahead" + type_str <- "Aheads" + } else if (latency_step$method == "extend_lags") { + step_names <- "step_epi_lag" + type_str <- "Lags" + } else { + step_names <- "" + type_str <- "columns locf" + } + later_steps[[1]]$columns + valid_columns <- later_steps %>% + keep(function(x) inherits(x, step_names)) %>% + purrr::map("columns") %>% + reduce(c) + latency_per_base_col <- latency_step$latency_table %>% + filter(col_name %in% valid_columns) %>% + mutate(latency = abs(latency)) + if (latency_step$method != "locf" && nrow(latency_per_base_col) > 1) { + intro_text <- glue::glue("{type_str} adjusted per column: ") + } else if (latency_step$method != "locf") { + intro_text <- glue::glue("{type_str} adjusted for ") + } + latency_info <- paste0(intro_text, paste(apply(latency_per_base_col, 1, paste0, collapse = "="), collapse = ", ")) + cli::cli_ul(latency_info) } - latency_info <- paste0(intro_text, paste(apply(latency_per_base_col, 1, paste0, collapse = "="), collapse = ", ")) - cli::cli_ul(latency_info) } cli::cli_text("") } diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index 8de21b3f..fb65d3e8 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -163,6 +163,7 @@ climatological_forecaster <- function(epi_data, # fill in some extras for plotting methods, etc. ewf <- epi_workflow() ewf$trained <- TRUE + ewf$original_data <- epi_data ewf$pre <- list(mold = list( outcomes = select(epi_data, !!sym_outcome), extras = list(roles = list( @@ -240,3 +241,10 @@ climate_args_list <- function( class = c("climate_fcast", "alist") ) } + +#' @export +print.climate_fcast <- function(x, ...) { + name <- "ARX Forecaster" + NextMethod(name = name, ...) +} + diff --git a/man/step_climate.Rd b/man/step_climate.Rd index 0a8bb57d..7b4fbb72 100644 --- a/man/step_climate.Rd +++ b/man/step_climate.Rd @@ -133,8 +133,10 @@ r \%>\% # same idea, but using weekly climate r <- epi_recipe(covid_case_death_rates) \%>\% step_epi_ahead(death_rate, ahead = 7) \%>\% - step_climate(death_rate, forecast_ahead = 1, time_type = "epiweek", - window_size = 1L) + step_climate(death_rate, + forecast_ahead = 1, time_type = "epiweek", + window_size = 1L + ) r r \%>\% From 7089c2f4c6d66e2cbaf4fd44db44a32a60e16cc6 Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Wed, 12 Feb 2025 10:44:00 -0600 Subject: [PATCH 37/54] David's suggestions --- R/climatological_forecaster.R | 2 ++ R/layer_threshold_preds.R | 1 + R/step_climate.R | 35 +++++++++++++++++++++++------- man/step_adjust_latency.Rd | 4 ++-- tests/testthat/test-step_climate.R | 7 ++++-- 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index fb65d3e8..f1f7d66e 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -67,6 +67,8 @@ climatological_forecaster <- function(epi_data, horizon <- args_list$forecast_horizon window_size <- args_list$window_size time_type <- args_list$time_type + # check that the prediction time type is more granular than epi_data's + # time_type ttype_ord <- match(time_type, c("day", "epiweek", "week", "month")) ttype_ord <- ttype_ord - as.integer(ttype_ord > 2) edf_ttype_ord <- match(edf_time_type, c("day", "week", "yearmonth")) diff --git a/R/layer_threshold_preds.R b/R/layer_threshold_preds.R index 7b8ca025..99f01612 100644 --- a/R/layer_threshold_preds.R +++ b/R/layer_threshold_preds.R @@ -61,6 +61,7 @@ layer_threshold_new <- +#' restrict various objects to the interval [lower, upper] snap <- function(x, lower, upper, ...) { UseMethod("snap") } diff --git a/R/step_climate.R b/R/step_climate.R index 2f88ca94..38a5a0ec 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -1,13 +1,14 @@ #' Calculate a climatological variable based on the history #' -#' `step_climate()` creates a *specification* of a recipe step -#' that will generate one or more new columns of derived data. This step -#' examines all available seasons in the training data and calculates the -#' a measure of center for the "typical" season. Think of this like with -#' the weather: to predict the temperature in January in Pittsburgh, PA, -#' I might look at all previous January's on record, average their temperatures, -#' and include that in my model. So it is important to _align_ the forecast -#' horizon with the climate. See the details for more information. +#' `step_climate()` creates a *specification* of a recipe step that will +#' generate one or more new columns of derived data. This step examines all +#' available seasons in the training data and calculates the a measure of center +#' for the "typical" season. Think of this like with the weather: to predict the +#' temperature in January in Pittsburgh, PA, I might look at all previous +#' January's on record, average their temperatures, and include that in my +#' model. So it is important to _align_ the forecast horizon with the climate. +#' This step will work best if added after `step_epi_ahead()`, but that is not +#' strictly required. See the details for more information. #' #' @details #' Construction of a climate predictor can be helpful with strongly seasonal @@ -101,6 +102,16 @@ #' r %>% #' prep(covid_case_death_rates) %>% #' bake(new_data = NULL) +#' +#' # switching the order is possible if you specify `forecast_ahead` +#' r <- epi_recipe(covid_case_death_rates) %>% +#' step_climate(death_rate, forecast_ahead = 7, time_type = "day") %>% +#' step_epi_ahead(death_rate, ahead = 7) %>% +#' r() +#' +#' r %>% +#' prep(covid_case_death_rates) %>% +#' bake(new_data = NULL) step_climate <- function(recipe, ..., @@ -315,6 +326,14 @@ print.step_climate <- function(x, width = max(20, options()$width - 30), ...) { invisible(x) } +#' group col by .idx values and sum windows around each .idx value +#' @param .idx the relevant periodic part of time value, e.g. the week number +#' @param col the list of values indexed by `.idx` +#' @param weights how much to weigh each particular datapoint +#' @param aggr the aggregation function, probably Quantile, mean or median +#' @param window_size the number of .idx entries before and after to include in +#' the aggregation +#' @param modulus the maximum value of `.idx` roll_modular_multivec <- function(col, .idx, weights, aggr, window_size, modulus) { tib <- tibble(col = col, weights = weights, .idx = .idx) |> arrange(.idx) |> diff --git a/man/step_adjust_latency.Rd b/man/step_adjust_latency.Rd index 75d67447..1fadd3ab 100644 --- a/man/step_adjust_latency.Rd +++ b/man/step_adjust_latency.Rd @@ -267,8 +267,8 @@ while this will not: \if{html}{\out{
}}\preformatted{toy_recipe <- epi_recipe(toy_df) \%>\% step_epi_lag(a, lag=0) \%>\% step_adjust_latency(a, method = "extend_lags") -#> Warning: If `method` is "extend_lags" or "locf", then the previous `step_epi_lag`s won't -#> work with modified data. +#> Warning: If `method` is "extend_lags" or "locf", then the previous `step_epi_lag`s won't work with +#> modified data. }\if{html}{\out{
}} If you create columns that you then apply lags to (such as diff --git a/tests/testthat/test-step_climate.R b/tests/testthat/test-step_climate.R index 04578948..480eb62b 100644 --- a/tests/testthat/test-step_climate.R +++ b/tests/testthat/test-step_climate.R @@ -10,6 +10,7 @@ test_that("roll_modular_multivec works", { Median <- function(x, w) median(x, na.rm = TRUE) # unweighted mean + # window of size 0 expected_res <- tib |> mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus) |> summarise(climate_pred = weighted.mean(col, w = w), .by = .idx) @@ -17,13 +18,15 @@ test_that("roll_modular_multivec works", { roll_modular_multivec(tib$col, tib$.idx, tib$w, Mean, 0, modulus), expected_res ) - w_size <- 1L + # window of size 1, which includes everything expected_res <- tibble(.idx = as.double(1:3), climate_pred = mean(tib$col)) expect_equal( roll_modular_multivec(tib$col, tib$.idx, tib$w, Mean, 1L, modulus), expected_res ) + # weighted mean + # window of size 0 tib$w <- c(1, 2, 3, 1, 2, 1, 1, 2, 2, 1) expected_res <- tib |> mutate(.idx = .idx %% modulus, .idx = .idx + (.idx == 0) * modulus) |> @@ -32,7 +35,7 @@ test_that("roll_modular_multivec works", { roll_modular_multivec(tib$col, tib$.idx, tib$w, Mean, 0, modulus), expected_res ) - tib$w <- c(1, 2, 3, 1, 2, 1, 1, 2, 2, 1) + # window of size 1 expected_res <- tibble( .idx = as.double(1:3), climate_pred = weighted.mean(tib$col, tib$w) From 60d6aeb5dff90e7ae3f7d2a647ee4472d76250fa Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Thu, 13 Feb 2025 14:14:39 -0600 Subject: [PATCH 38/54] time_type defaulting to the epi_df's time_type --- R/step_climate.R | 7 ++++++- tests/testthat/test-step_climate.R | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/R/step_climate.R b/R/step_climate.R index 38a5a0ec..6169bd2a 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -117,7 +117,7 @@ step_climate <- ..., forecast_ahead = "detect", role = "predictor", - time_type = c("epiweek", "week", "month", "day"), + time_type = c("detect", "epiweek", "week", "month", "day"), center_method = c("median", "mean"), window_size = 3L, epi_keys = NULL, @@ -132,6 +132,11 @@ step_climate <- n_outcomes <- sum(recipe$var_info$role == "outcome") time_type <- rlang::arg_match(time_type) edf_time_type <- attr(recipe$template, "metadata")$time_type + if (time_type == "detect") { + time_type <- edf_time_type + } else { + edf_time_type <- attr(recipe$template, "metadata")$time_type + } if (edf_time_type == "custom") { cli_abort("This step only works with daily, weekly, or yearmonth data.") } diff --git a/tests/testthat/test-step_climate.R b/tests/testthat/test-step_climate.R index 480eb62b..2544a77a 100644 --- a/tests/testthat/test-step_climate.R +++ b/tests/testthat/test-step_climate.R @@ -69,7 +69,7 @@ test_that("prep/bake steps create the correct training data", { ) %>% as_epi_df() # epiweeks 1, 52, and 53 are all 1, note that there are days in wk 52, 2 in wk 53 - r <- epi_recipe(x) %>% step_climate(y) + r <- epi_recipe(x) %>% step_climate(y, time_type = "epiweek") p <- prep(r, x) expected_res <- tibble(.idx = 1:53, climate_y = c(2, 2:25, 25, 25, 25:2, 2, 2)) @@ -97,7 +97,7 @@ test_that("leading the climate predictor works as expected", { r <- epi_recipe(x) %>% step_epi_ahead(y, ahead = 14L) %>% step_epi_lag(y, lag = c(0, 7L, 14L)) %>% - step_climate(y, forecast_ahead = 2L) %>% + step_climate(y, forecast_ahead = 2L, time_type = "epiweek") %>% # matches the response step_epi_naomit() p <- prep(r, x) From 759a3b80ea02c389b58cae729c7283c71b58e453 Mon Sep 17 00:00:00 2001 From: David Weber Date: Fri, 14 Feb 2025 12:41:33 -0800 Subject: [PATCH 39/54] unneeded else branch Co-authored-by: Daniel McDonald --- R/step_climate.R | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/R/step_climate.R b/R/step_climate.R index 6169bd2a..db66aa32 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -132,11 +132,7 @@ step_climate <- n_outcomes <- sum(recipe$var_info$role == "outcome") time_type <- rlang::arg_match(time_type) edf_time_type <- attr(recipe$template, "metadata")$time_type - if (time_type == "detect") { - time_type <- edf_time_type - } else { - edf_time_type <- attr(recipe$template, "metadata")$time_type - } + if (time_type == "detect") time_type <- edf_time_type if (edf_time_type == "custom") { cli_abort("This step only works with daily, weekly, or yearmonth data.") } From 5d062db65c8a553159f4d051ca923768fad37ca7 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Sun, 16 Feb 2025 08:41:19 -0800 Subject: [PATCH 40/54] fu styler!! --- R/climatological_forecaster.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index f1f7d66e..7fdc4fa6 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -249,4 +249,3 @@ print.climate_fcast <- function(x, ...) { name <- "ARX Forecaster" NextMethod(name = name, ...) } - From 21c67cd868de94112c4a16988b06805c82ce6f74 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Sun, 16 Feb 2025 08:52:37 -0800 Subject: [PATCH 41/54] deletion from news --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index da6a5a1f..8d0d6065 100644 --- a/NEWS.md +++ b/NEWS.md @@ -23,6 +23,7 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.0.x will indicat - Make key column inference more consistent within the package and with current `epiprocess`. - Fix `quantile_reg()` producing error when asked to output just median-level predictions. - (temporary) ahead negative is allowed for `step_epi_ahead` until we have `step_epi_shift` +- Add `reference_date` as an argument to `epi_recipe()` - Add `step_climate()` to create "climate" predictor in forecast workflows - Add `climatological_forecaster()` to automatically create climate baselines From 05f04906b29bfed2de2a2c2a62bb1767f0f74410 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Sun, 16 Feb 2025 09:30:06 -0800 Subject: [PATCH 42/54] redocument, update snapshots --- R/layer_threshold_preds.R | 2 +- R/step_climate.R | 4 ++-- man/roll_modular_multivec.Rd | 25 +++++++++++++++++++++++++ man/step_adjust_latency.Rd | 4 ++-- man/step_climate.Rd | 29 ++++++++++++++++++++--------- tests/testthat/_snaps/snapshots.md | 2 -- 6 files changed, 50 insertions(+), 16 deletions(-) create mode 100644 man/roll_modular_multivec.Rd diff --git a/R/layer_threshold_preds.R b/R/layer_threshold_preds.R index 99f01612..0f7fe700 100644 --- a/R/layer_threshold_preds.R +++ b/R/layer_threshold_preds.R @@ -61,7 +61,7 @@ layer_threshold_new <- -#' restrict various objects to the interval [lower, upper] +# restrict various objects to the interval [lower, upper] snap <- function(x, lower, upper, ...) { UseMethod("snap") } diff --git a/R/step_climate.R b/R/step_climate.R index db66aa32..72f595e9 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -106,8 +106,8 @@ #' # switching the order is possible if you specify `forecast_ahead` #' r <- epi_recipe(covid_case_death_rates) %>% #' step_climate(death_rate, forecast_ahead = 7, time_type = "day") %>% -#' step_epi_ahead(death_rate, ahead = 7) %>% -#' r() +#' step_epi_ahead(death_rate, ahead = 7) +#' r #' #' r %>% #' prep(covid_case_death_rates) %>% diff --git a/man/roll_modular_multivec.Rd b/man/roll_modular_multivec.Rd new file mode 100644 index 00000000..a26cd588 --- /dev/null +++ b/man/roll_modular_multivec.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/step_climate.R +\name{roll_modular_multivec} +\alias{roll_modular_multivec} +\title{group col by .idx values and sum windows around each .idx value} +\usage{ +roll_modular_multivec(col, .idx, weights, aggr, window_size, modulus) +} +\arguments{ +\item{col}{the list of values indexed by \code{.idx}} + +\item{.idx}{the relevant periodic part of time value, e.g. the week number} + +\item{weights}{how much to weigh each particular datapoint} + +\item{aggr}{the aggregation function, probably Quantile, mean or median} + +\item{window_size}{the number of .idx entries before and after to include in +the aggregation} + +\item{modulus}{the maximum value of \code{.idx}} +} +\description{ +group col by .idx values and sum windows around each .idx value +} diff --git a/man/step_adjust_latency.Rd b/man/step_adjust_latency.Rd index 1fadd3ab..75d67447 100644 --- a/man/step_adjust_latency.Rd +++ b/man/step_adjust_latency.Rd @@ -267,8 +267,8 @@ while this will not: \if{html}{\out{
}}\preformatted{toy_recipe <- epi_recipe(toy_df) \%>\% step_epi_lag(a, lag=0) \%>\% step_adjust_latency(a, method = "extend_lags") -#> Warning: If `method` is "extend_lags" or "locf", then the previous `step_epi_lag`s won't work with -#> modified data. +#> Warning: If `method` is "extend_lags" or "locf", then the previous `step_epi_lag`s won't +#> work with modified data. }\if{html}{\out{
}} If you create columns that you then apply lags to (such as diff --git a/man/step_climate.Rd b/man/step_climate.Rd index 7b4fbb72..9b29fdc4 100644 --- a/man/step_climate.Rd +++ b/man/step_climate.Rd @@ -9,7 +9,7 @@ step_climate( ..., forecast_ahead = "detect", role = "predictor", - time_type = c("epiweek", "week", "month", "day"), + time_type = c("detect", "epiweek", "week", "month", "day"), center_method = c("median", "mean"), window_size = 3L, epi_keys = NULL, @@ -72,14 +72,15 @@ An updated version of \code{recipe} with the new step added to the sequence of any existing operations. } \description{ -\code{step_climate()} creates a \emph{specification} of a recipe step -that will generate one or more new columns of derived data. This step -examines all available seasons in the training data and calculates the -a measure of center for the "typical" season. Think of this like with -the weather: to predict the temperature in January in Pittsburgh, PA, -I might look at all previous January's on record, average their temperatures, -and include that in my model. So it is important to \emph{align} the forecast -horizon with the climate. See the details for more information. +\code{step_climate()} creates a \emph{specification} of a recipe step that will +generate one or more new columns of derived data. This step examines all +available seasons in the training data and calculates the a measure of center +for the "typical" season. Think of this like with the weather: to predict the +temperature in January in Pittsburgh, PA, I might look at all previous +January's on record, average their temperatures, and include that in my +model. So it is important to \emph{align} the forecast horizon with the climate. +This step will work best if added after \code{step_epi_ahead()}, but that is not +strictly required. See the details for more information. } \details{ Construction of a climate predictor can be helpful with strongly seasonal @@ -139,6 +140,16 @@ r <- epi_recipe(covid_case_death_rates) \%>\% ) r +r \%>\% + prep(covid_case_death_rates) \%>\% + bake(new_data = NULL) + +# switching the order is possible if you specify `forecast_ahead` +r <- epi_recipe(covid_case_death_rates) \%>\% + step_climate(death_rate, forecast_ahead = 7, time_type = "day") \%>\% + step_epi_ahead(death_rate, ahead = 7) +r + r \%>\% prep(covid_case_death_rates) \%>\% bake(new_data = NULL) diff --git a/tests/testthat/_snaps/snapshots.md b/tests/testthat/_snaps/snapshots.md index 53940e1b..6837f262 100644 --- a/tests/testthat/_snaps/snapshots.md +++ b/tests/testthat/_snaps/snapshots.md @@ -1207,7 +1207,6 @@ * 56 unique geographic regions, * At forecast date: 2022-01-03, * For target date: 2022-01-10, - * Lags adjusted per column: case_rate=3, death_rate=3 --- @@ -1231,7 +1230,6 @@ * 56 unique geographic regions, * At forecast date: 2022-01-03, * For target date: 2022-01-10, - * Aheads adjusted for death_rate=3 # arx_classifier snapshots From cfad1f18ba2309c63e84c6a2bd3c1573bdfd241a Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Sun, 16 Feb 2025 10:06:35 -0800 Subject: [PATCH 43/54] update snaps for upstream package --- tests/testthat/_snaps/step_adjust_latency.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/testthat/_snaps/step_adjust_latency.md b/tests/testthat/_snaps/step_adjust_latency.md index 139e8084..cffb7270 100644 --- a/tests/testthat/_snaps/step_adjust_latency.md +++ b/tests/testthat/_snaps/step_adjust_latency.md @@ -36,11 +36,10 @@ Training data contained 200 data points and no incomplete rows. -- Operations - 1. Adj. extend_lags: case_rate and death_rate w/ forecast date 2021-07-24 | - 2. Trained - 3. Lagging: death_rate by 5, 11, 16, (lat adj) | Trained - 4. Lagging: case_rate by 6, 10, (lat adj) | Trained - 5. Leading: death_rate by 7 | Trained + 1. Adj. extend_lags: case_rate death_rate w/ forecast date 2021-07-24 | Trained + 2. Lagging: death_rate by 5, 11, 16, (lat adj) | Trained + 3. Lagging: case_rate by 6, 10, (lat adj) | Trained + 4. Leading: death_rate by 7 | Trained --- From bece1fe21fd75ea64d2feeffad6798ae7121adc5 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Wed, 19 Feb 2025 08:33:50 -0800 Subject: [PATCH 44/54] compute the .pred_distn using residuals. document the default --- R/climatological_forecaster.R | 13 +++++++++++-- man/climatological_forecaster.Rd | 11 +++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index 7fdc4fa6..8796d705 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -7,8 +7,15 @@ #' forecast, essentially predicting "typical January" behavior by relying on a #' long history of such periods rather than heavily using recent data. #' -#' The forecast is taken as the quantiles of the `outcome` in a small window -#' around the target period, computed over the entire available history. +#' The point forecast is either the mean or median of the `outcome` in a small +#' window around the target period, computed over the entire available history, +#' separately for each key in the `epi_df` (`geo_value` and any additional keys). +#' The forecast quantiles are computed from the residuals for this point prediction. +#' By default, the residuals are ungrouped, meaning every key will have the same +#' shape distribution (though different centers). Note that if your data is not +#' or comparable scales across keys, this default is likely inappropriate. In that +#' case, you can choose by which keys quantiles are computed using +#' `climate_args_list(quantile_by_key = ...)`. #' #' @inheritParams flatline_forecaster #' @param args_list A list of additional arguments as created by the @@ -124,6 +131,8 @@ climatological_forecaster <- function(epi_data, ))) } climate_quantiles <- epi_data %>% + left_join(climate_center, by = c(".idx", keys)) %>% + mutate(sym_outcome = sym_outcome - .pred) %>% select(.idx, .weights, all_of(c(outcome, args_list$quantile_by_key))) %>% dplyr::reframe( roll_modular_multivec( diff --git a/man/climatological_forecaster.Rd b/man/climatological_forecaster.Rd index 26923c9a..1fff8a0a 100644 --- a/man/climatological_forecaster.Rd +++ b/man/climatological_forecaster.Rd @@ -27,8 +27,15 @@ forecast, essentially predicting "typical January" behavior by relying on a long history of such periods rather than heavily using recent data. } \details{ -The forecast is taken as the quantiles of the \code{outcome} in a small window -around the target period, computed over the entire available history. +The point forecast is either the mean or median of the \code{outcome} in a small +window around the target period, computed over the entire available history, +separately for each key in the \code{epi_df} (\code{geo_value} and any additional keys). +The forecast quantiles are computed from the residuals for this point prediction. +By default, the residuals are ungrouped, meaning every key will have the same +shape distribution (though different centers). Note that if your data is not +or comparable scales across keys, this default is likely inappropriate. In that +case, you can choose by which keys quantiles are computed using +\code{climate_args_list(quantile_by_key = ...)}. } \examples{ rates <- cases_deaths_subset From 5e3ed566896f126b087324b4415ff2149002dc71 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Wed, 19 Feb 2025 08:52:12 -0800 Subject: [PATCH 45/54] fix rlang bug, more detailed examples --- R/climatological_forecaster.R | 24 +++++++++++++++--------- man/climatological_forecaster.Rd | 19 +++++++++++++------ 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index 8796d705..b8a522b5 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -27,15 +27,18 @@ #' @seealso [step_climate()] #' #' @examples -#' rates <- cases_deaths_subset +#' cases <- cases_deaths_subset #' # set as_of to the last day in the data -#' attr(rates, "metadata")$as_of <- as.Date("2021-12-31") -#' fcast <- climatological_forecaster(rates, "case_rate_7d_av") +#' # "case_rate_7d_av" is on the same scale for all geographies +#' attr(cases, "metadata")$as_of <- as.Date("2021-12-31") +#' fcast <- climatological_forecaster(cases, "case_rate_7d_av") #' autoplot(fcast) #' #' # Compute quantiles separately by location, and a backcast +#' # "cases" is on different scales by geography, due to population size +#' # so, it is better to compute quantiles separately #' backcast <- climatological_forecaster( -#' rates, "case_rate_7d_av", +#' cases, "case_rate_7d_av", #' climate_args_list( #' quantile_by_key = "geo_value", #' forecast_date = as.Date("2021-06-01") @@ -45,10 +48,14 @@ #' #' # compute the climate "daily" rather than "weekly" #' # use a two week window (on both sides) +#' # "cases" is on different scales by geography, due to population size #' daily_fcast <- climatological_forecaster( -#' rates, "case_rate_7d_av", +#' cases, "cases", #' climate_args_list( -#' time_type = "day", window_size = 14L, forecast_horizon = 0:30 +#' quantile_by_key = "geo_value", +#' time_type = "day", +#' window_size = 14L, +#' forecast_horizon = 0:30 #' ) #' ) #' autoplot(daily_fcast) + @@ -87,7 +94,7 @@ climatological_forecaster <- function(epi_data, )) } # process the time types - sym_outcome <- sym(outcome) + sym_outcome <- rlang::data_sym(outcome) epi_data <- epi_data %>% filter(!is.na(!!outcome)) %>% select(all_of(c(key_colnames(epi_data), outcome))) @@ -123,7 +130,6 @@ climatological_forecaster <- function(epi_data, rename(.pred = climate_pred) # get the quantiles Quantile <- function(x, w) { - x <- x - stats::median(x, na.rm = TRUE) if (args_list$symmetrize) x <- c(x, -x) list(unname(quantile( x, @@ -132,7 +138,7 @@ climatological_forecaster <- function(epi_data, } climate_quantiles <- epi_data %>% left_join(climate_center, by = c(".idx", keys)) %>% - mutate(sym_outcome = sym_outcome - .pred) %>% + mutate({{outcome}} := !!sym_outcome - .pred) %>% select(.idx, .weights, all_of(c(outcome, args_list$quantile_by_key))) %>% dplyr::reframe( roll_modular_multivec( diff --git a/man/climatological_forecaster.Rd b/man/climatological_forecaster.Rd index 1fff8a0a..d773ebce 100644 --- a/man/climatological_forecaster.Rd +++ b/man/climatological_forecaster.Rd @@ -38,15 +38,18 @@ case, you can choose by which keys quantiles are computed using \code{climate_args_list(quantile_by_key = ...)}. } \examples{ -rates <- cases_deaths_subset +cases <- cases_deaths_subset # set as_of to the last day in the data -attr(rates, "metadata")$as_of <- as.Date("2021-12-31") -fcast <- climatological_forecaster(rates, "case_rate_7d_av") +# "case_rate_7d_av" is on the same scale for all geographies +attr(cases, "metadata")$as_of <- as.Date("2021-12-31") +fcast <- climatological_forecaster(cases, "case_rate_7d_av") autoplot(fcast) # Compute quantiles separately by location, and a backcast +# "cases" is on different scales by geography, due to population size +# so, it is better to compute quantiles separately backcast <- climatological_forecaster( - rates, "case_rate_7d_av", + cases, "case_rate_7d_av", climate_args_list( quantile_by_key = "geo_value", forecast_date = as.Date("2021-06-01") @@ -56,10 +59,14 @@ autoplot(backcast) # compute the climate "daily" rather than "weekly" # use a two week window (on both sides) +# "cases" is on different scales by geography, due to population size daily_fcast <- climatological_forecaster( - rates, "case_rate_7d_av", + cases, "cases", climate_args_list( - time_type = "day", window_size = 14L, forecast_horizon = 0:30 + quantile_by_key = "geo_value", + time_type = "day", + window_size = 14L, + forecast_horizon = 0:30 ) ) autoplot(daily_fcast) + From 8238703e40ca412b64b9be7127bd1031fca2bf23 Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Wed, 19 Feb 2025 09:14:20 -0800 Subject: [PATCH 46/54] pass checks --- R/climatological_forecaster.R | 2 +- tests/testthat/_snaps/snapshots.md | 1756 +++++++++++++--------------- tests/testthat/test-snapshots.R | 5 +- 3 files changed, 844 insertions(+), 919 deletions(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index b8a522b5..a5d92f09 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -94,7 +94,7 @@ climatological_forecaster <- function(epi_data, )) } # process the time types - sym_outcome <- rlang::data_sym(outcome) + sym_outcome <- sym(outcome) epi_data <- epi_data %>% filter(!is.na(!!outcome)) %>% select(all_of(c(key_colnames(epi_data), outcome))) diff --git a/tests/testthat/_snaps/snapshots.md b/tests/testthat/_snaps/snapshots.md index 6837f262..45223fa5 100644 --- a/tests/testthat/_snaps/snapshots.md +++ b/tests/testthat/_snaps/snapshots.md @@ -1303,125 +1303,125 @@ 66.9333338, 70.0729902, 60.5814898, 62.3893953, 94.69837105, 52.17697935, 69.7197773, 67.80972325, 57.0623769, 66.48962015, 75.3837738, 51.3826096, 67.5469116, 65.9446612, 45.2947493, 67.3274732 - ), .pred_distn = structure(list(structure(list(values = c(37.581706945, - 40.53309523, 68.6068873166667, 81.6909143, 101.23192885, 124.123961743333, - 133.701228665), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + ), .pred_distn = structure(list(structure(list(values = c(58.912419115, + 63.8539116, 78.6221968916667, 87.443016025, 96.4306031625, 110.01340202, + 130.62914179), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(2.838472345, 5.78986063, - 33.8636527166667, 46.9476797, 66.48869425, 89.3807271433334, - 98.957994065), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(24.169184515, 29.110677, + 43.8789622916667, 52.699781425, 61.6873685625, 75.2701674200001, + 95.88590719), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(13.033559045, 15.98494733, - 44.0587394166667, 57.1427664, 76.68378095, 99.5758138433333, - 109.153080765), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(34.364271215, 39.3057637, + 54.0740489916667, 62.894868125, 71.8824552625, 85.4652541200001, + 106.08099389), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(11.380172745, 14.33156103, - 42.4053531166667, 55.4893801, 75.03039465, 97.9224275433334, - 107.499694465), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(32.710884915, 37.6523774, + 52.4206626916667, 61.241481825, 70.2290689625, 83.8118678200001, + 104.42760759), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(20.848543545, 23.79993183, - 51.8737239166667, 64.9577509, 84.49876545, 107.390798343333, - 116.968065265), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(42.179255715, 47.1207482, + 61.8890334916667, 70.709852625, 79.6974397625, 93.2802386200001, + 113.89597839), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(5.208805345, 8.16019363, - 36.2339857166667, 49.3180127, 68.85902725, 91.7510601433333, - 101.328327065), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(26.539517515, 31.48101, + 46.2492952916667, 55.070114425, 64.0577015625, 77.6405004200001, + 98.25624019), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(46.0821344, 60.71441945, - 80.2739618916667, 92.3266162, 108.315284833333, 130.664387783333, - 140.133233), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(70.0311977125, 75.2240245166667, + 91.1454313916667, 98.454914125, 107.373545891667, 123.554305783333, + 144.7359469125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(5.25184394999999, 19.884129, - 39.4436714416667, 51.49632575, 67.4849943833333, 89.8340973333333, - 99.30294255), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(29.2009072625, 34.3937340666667, + 50.3151409416667, 57.624623675, 66.5432554416667, 82.7240153333334, + 103.9056564625), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(15.786899, 30.41918405, - 49.9787264916667, 62.0313808, 78.0200494333333, 100.369152383333, - 109.8379976), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(39.7359623125, 44.9287891166667, + 60.8501959916667, 68.159678725, 77.0783104916667, 93.2590703833334, + 114.4407115125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(23.04576595, 37.678051, - 57.2375934416667, 69.29024775, 85.2789163833333, 107.628019333333, - 117.09686455), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(46.9948292625, 52.1876560666667, + 68.1090629416667, 75.418545675, 84.3371774416667, 100.517937333333, + 121.6995784625), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(18.9619203, 33.59420535, - 53.1537477916667, 65.2064021, 81.1950707333333, 103.544173683333, - 113.0130189), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(42.9109836125, 48.1038104166667, + 64.0252172916667, 71.334700025, 80.2533317916667, 96.4340916833333, + 117.6157328125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(14.4898862, 29.12217125, - 48.6817136916667, 60.734368, 76.7230366333333, 99.0721395833334, - 108.5409848), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(38.4389495125, 43.6317763166667, + 59.5531831916667, 66.862665925, 75.7812976916667, 91.9620575833334, + 113.1436987125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(71.810054805, 79.4526884866667, - 88.220075625, 97.9375799, 114.304113091667, 137.30686307, 146.48749288 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(25.945926505, 33.5885601866667, 42.355947325, - 52.0734516, 68.4399847916667, 91.44273477, 100.62336458), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(40.805808705, 48.4484423866667, - 57.215829525, 66.9333338, 83.2998669916667, 106.30261697, 115.48324678 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(43.945465105, 51.5880987866667, 60.355485925, - 70.0729902, 86.4395233916667, 109.44227337, 118.62290318), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(34.453964705, 42.0965983866667, - 50.863985525, 60.5814898, 76.9480229916667, 99.95077297, 109.13140278 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(36.261870205, 43.9045038866667, 52.671891025, - 62.3893953, 78.7559284916667, 101.75867847, 110.93930828), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(71.98481162, 75.1198124633333, - 84.7910693916667, 94.69837105, 109.307554591667, 131.848629753333, - 140.895032215), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(82.576852205, 90.8680012616667, + 96.763374925, 102.9301931, 111.617195108333, 125.002081223333, + 154.43090355), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(36.712723905, 45.0038729616667, + 50.899246625, 57.0660648, 65.7530668083333, 79.1379529233334, + 108.56677525), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(51.572606105, 59.8637551616667, + 65.759128825, 71.925947, 80.6129490083333, 93.9978351233334, + 123.42665745), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(54.712262505, 63.0034115616667, + 68.898785225, 75.0656034, 83.7526054083333, 97.1374915233334, + 126.56631385), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(29.46341992, 32.5984207633333, - 42.2696776916667, 52.17697935, 66.7861628916667, 89.3272380533333, - 98.373640515), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(45.220762105, 53.5119111616667, + 59.407284825, 65.574103, 74.2611050083333, 87.6459911233334, + 117.07481345), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(47.00621787, 50.1412187133333, - 59.8124756416667, 69.7197773, 84.3289608416667, 106.870036003333, - 115.916438465), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(47.028667605, 55.3198166616667, + 61.215190325, 67.3820085, 76.0690105083333, 89.4538966233334, + 118.88271895), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(45.09616382, 48.2311646633333, - 57.9024215916667, 67.80972325, 82.4189067916667, 104.959981953333, - 114.006384415), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(87.348649135, 89.0869120166667, + 93.3996244833333, 98.4483999, 106.692614608333, 116.011698185, + 127.641653255), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(34.34881747, 37.4838183133333, - 47.1550752416667, 57.0623769, 71.6715604416667, 94.2126356033334, - 103.259038065), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(44.827257435, 46.5655203166667, + 50.8782327833333, 55.9270082, 64.1712229083333, 73.490306485, + 85.120261555), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(43.77606072, 46.9110615633333, - 56.5823184916667, 66.48962015, 81.0988036916667, 103.639878853333, - 112.686281315), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(62.370055385, 64.1083182666667, + 68.4210307333333, 73.46980615, 81.7140208583333, 91.033104435, + 102.663059505), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(46.908072705, 51.4679015966667, - 60.7768339583333, 75.3837738, 89.767610275, 102.406549163333, - 116.665952285), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(60.460001335, 62.1982642166667, + 66.5109766833333, 71.5597521, 79.8039668083333, 89.123050385, + 100.753005455), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(22.906908505, 27.4667373966667, - 36.7756697583333, 51.3826096, 65.766446075, 78.4053849633334, - 92.664788085), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(49.712654985, 51.4509178666667, + 55.7636303333333, 60.81240575, 69.0566204583333, 78.375704035, + 90.005659105), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(39.071210505, 43.6310393966667, - 52.9399717583333, 67.5469116, 81.930748075, 94.5696869633334, - 108.829090085), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(59.139898235, 60.8781611166667, + 65.1908735833333, 70.239649, 78.4838637083333, 87.802947285, + 99.432902355), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(37.468960105, 42.0287889966667, - 51.3377213583333, 65.9446612, 80.328497675, 92.9674365633334, - 107.226839685), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(68.3244717525, 70.02935424, + 73.7662491958333, 77.6331969, 84.5239736125, 91.3536477133333, + 95.739326825), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(16.819048205, 21.3788770966667, - 30.6878094583333, 45.2947493, 59.678585775, 72.3175246633334, - 86.576927785), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(44.3233075525, 46.02819004, + 49.7650849958333, 53.6320327, 60.5228094125, 67.3524835133333, + 71.738162625), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(38.851772105, 43.4116009966667, - 52.7205333583333, 67.3274732, 81.711309675, 94.3502485633334, - 108.609651685), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(60.4876095525, 62.19249204, + 65.9293869958333, 69.7963347, 76.6871114125, 83.5167855133333, + 87.902464625), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(58.8853591525, 60.59024164, + 64.3271365958333, 68.1940843, 75.0848610125, 81.9145351133333, + 86.300214225), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(38.2354472525, 39.94032974, + 43.6772246958333, 47.5441724, 54.4349491125, 61.2646232133333, + 65.650302325), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(60.2681711525, 61.97305364, + 65.7099485958333, 69.5768963, 76.4676730125, 83.2973471133333, + 87.683026225), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr"))), class = c("distribution", "vctrs_vctr", "list" ))), row.names = c(NA, -30L), class = c("tbl_df", "tbl", "data.frame" @@ -1440,140 +1440,125 @@ 18779, 18779, 18779, 18786, 18786, 18786, 18786, 18786, 18786, 18793, 18793, 18793, 18793, 18793, 18793, 18800, 18800, 18800, 18800, 18800, 18800, 18807, 18807, 18807, 18807, 18807, 18807 - ), class = "Date"), .pred = c(4.5027417, 6.6356332, 6.06441615, - 6.0225729, 5.3742185, 4.7252087, 4.5167124, 7.262058, 5.76229575, - 3.88009725, 4.3058565, 5.0086288, 4.7631049, 7.5289294, 5.493522, - 3.38954425, 4.0672631, 5.5988237, 6.6727377, 7.9200341, 6.12777475, - 3.37439915, 3.8526967, 6.8619285, 7.53783305, 10.69490535, 7.3882769, - 3.41133835, 3.62304355, 8.11067975), .pred_distn = structure(list( - structure(list(values = c(2.38454615, 2.47051743333333, 3.248099325, - 4.5027417, 5.70162214166667, 7.33486465, 8.302502625), quantile_levels = c(0.05, + ), class = "Date"), .pred = c(1782, 927.5, 577.5, 935, 635, 1321, + 1791, 934.5, 561, 765.5, 529.5, 1435, 2153.5, 946.5, 607, 673, + 476, 1663.5, 2486.5, 1138, 659.5, 637.5, 446.5, 2002, 3236, 1311, + 879.5, 666.5, 446.5, 2964), .pred_distn = structure(list(structure(list( + values = c(512, 651.333333333334, 1098.45833333333, 1678, + 2429.04166666667, 3110.91666666667, 3621.875), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2.941008575, 3.04656301666667, 3.4802291, - 6.6356332, 9.54985604166666, 14.0389050833333, 15.40788105 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(3.084228825, 3.18927068333333, - 3.79729063333333, 6.06441615, 6.82660870833333, 7.91693196666667, - 8.55974365), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1.736328725, - 1.99287171666667, 3.29602638333333, 6.0225729, 9.486795875, - 12.0870102666667, 15.46498015), quantile_levels = c(0.05, + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(0, 0, 365.541666666667, 927.5, 2329.29166666667, + 3263.83333333333, 3892.5), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(220.125, 253.166666666667, 342, 540.5, 733.375, + 854.166666666667, 977), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(435.375, + 506.583333333333, 567.875, 776, 1103.75, 1465.83333333333, 1673.125 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(312.25, 377.833333333333, 453.416666666667, 584.25, + 726.541666666667, 1037.33333333333, 1516.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(1.857899425, 2.42411633333333, 3.72101395833333, - 5.3742185, 8.371536425, 12.3141013833333, 15.1794572), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(2.980046525, 3.21736526666667, - 3.60125955, 4.7252087, 7.12831905833333, 8.08197281666667, - 9.6703417), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2.19893535, - 2.37792371666667, 2.69084345, 4.5167124, 6.748578625, 9.16127798333333, - 13.412516575), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2.96812295, - 3.28451243333333, 3.59197331666667, 7.262058, 10.3093879, - 14.0389050833333, 16.80747705), quantile_levels = c(0.05, + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(149.5, 363.666666666667, 814.333333333333, 1149, + 2003.95833333333, 3254.66666666667, 3883.375), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2.9968607, 3.16970731666667, 3.48405473333333, - 5.76229575, 6.78714855, 8.2655153, 12.266553825), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(1.699020075, 1.76237088333333, 2.94184070833333, - 3.88009725, 7.6115141, 9.69187023333334, 10.53857905), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(1.429325275, 1.64221546666667, - 3.2692511, 4.3058565, 6.54110969166667, 9.77171271666667, - 11.50947725), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2.980046525, - 3.29951246666667, 3.72906213333333, 5.0086288, 7.14401055833333, - 10.4355353, 13.931860575), quantile_levels = c(0.05, 0.1, + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(0, 450.083333333333, 924.75, 1670.5, 2544.375, + 3821.08333333334, 4407.25), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2.17308045, 2.37260151666667, 2.6744535, 4.7631049, - 7.157146375, 14.3770701333333, 16.921886375), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3.320610175, 3.4718483, 5.29081370833333, - 7.5289294, 10.5415857, 21.2699595666667, 32.681890075 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(2.9928591, 3.15370095, - 3.46704794166667, 5.493522, 6.90330591666667, 14.4753227333333, - 19.3650486), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(0, 0, 6.41666666666674, 941.5, 2380.375, 4497.16666666667, + 9047.75), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1.699020075, - 1.76237088333333, 2.32421669166667, 3.38954425, 5.38881871666667, - 8.20912935, 9.0466034), quantile_levels = c(0.05, 0.1, 0.25, - 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1.37680125, - 1.4762617, 2.55570593333333, 4.0672631, 5.09530074166667, - 6.57891956666667, 8.144025225), quantile_levels = c(0.05, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(118.25, + 198.583333333333, 288.916666666667, 495.75, 736.625, 962, 1521.5 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(313.375, 350.166666666667, 409.083333333333, 597, + 860.791666666666, 1210.41666666667, 1353.25), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2.980046525, 3.396743, 3.95721734166667, 5.5988237, - 8.03927734166667, 17.0052045833334, 21.980382575), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2.17308045, 2.37260151666667, 2.6744535, 6.6727377, - 9.73053901666666, 17.8936369166667, 19.9899087), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3.35479075, 3.48718568333333, 6.60210994166667, - 7.9200341, 15.6093492, 36.5094573833333, 41.443292225 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(2.9928591, 3.15370095, - 3.46704794166667, 6.12777475, 8.7768301, 23.1434428666667, - 25.52850425), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1.699020075, - 1.76237088333333, 2.32421669166667, 3.37439915, 3.84931453333333, - 6.2235223, 7.467820475), quantile_levels = c(0.05, 0.1, 0.25, + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(206.75, 258.666666666667, 330.166666666667, 478.75, + 598.041666666667, 734.833333333333, 926.25), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(0, 281.083333333333, 790.666666666667, 1242.5, + 2162.125, 3593.5, 4306.625), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(0, 121.916666666668, 1184, 2179.25, 3261.875, + 4614.33333333333, 5419.75), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(0, 0, 11, 956, 2619, 8508.83333333334, 10103.25 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(0, 176.25, 306.791666666667, + 570, 839.958333333333, 1568.83333333333, 1901.25), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(238.125, 267.583333333333, 344.291666666667, 511.25, + 760.375, 1021.5, 1195), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1.37680125, - 1.4762617, 2.18002845, 3.8526967, 4.80334515833333, 5.6115081, - 5.8715209), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(147, + 190.5, 261.458333333333, 414, 545.458333333333, 664.583333333333, + 753.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(0, 72.3333333333335, + 931.041666666667, 1487.5, 2731.83333333333, 4390.16666666667, + 5059.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(0, 0, 1270.25, 2551, + 4018.70833333333, 5112.83333333333, 6004.375), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(0, 0, 175.541666666667, 1335.5, 4165.625, 8942.58333333333, + 11505.125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2.992210475, - 3.5098677, 4.2314739, 6.8619285, 10.5259945583333, 22.3190674833333, - 24.1472689), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(0, 0, + 321.458333333333, 564.75, 1010.20833333333, 1795, 2183.625), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(225.125, 257.333333333333, + 342.708333333333, 551.25, 724.875, 924.416666666667, 1071.75), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(106.125, 152.083333333333, + 221.166666666667, 363, 513.208333333333, 615.166666666667, 668 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(0, 125.166666666667, 943.833333333333, 1830, 3605.66666666667, + 5259.16666666667, 6957), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(0, 559.25, + 1879.875, 3330.75, 4889, 6122.66666666667, 7629.625), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(0, 0, 158.583333333333, 1687.5, 5516.375, 9507.75, + 12672.375), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2.17308045, - 2.41451368333333, 3.061490575, 7.53783305, 15.2485158416667, - 20.8146644333333, 22.099485925), quantile_levels = c(0.05, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(0, 3.41666666666674, + 500.375, 817.000000000001, 1497.16666666667, 2102.08333333333, + 2451.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(286.5, 311.333333333333, + 399.166666666667, 629.75, 792.041666666667, 1015, 1111), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(92.125, 139.833333333333, 211.666666666667, 343.75, + 513.208333333333, 626, 714.25), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(4.02049035, 5.14340998333333, 7.262058, 10.69490535, - 29.911455775, 47.71367525, 51.2570617), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2.9928591, 3.15370095, 3.50495200833333, 7.3882769, - 15.6448998, 27.4038069, 31.796668175), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(1.699020075, 1.76237088333333, 2.32421669166667, - 3.41133835, 3.99577863333333, 5.58521231666667, 6.239036775 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(1.37680125, 1.4762617, - 2.18002845, 3.62304355, 4.475069675, 5.69346058333333, 6.07323565 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(3.765229625, 4.06819315, - 5.00246570833333, 8.11067975, 17.418860025, 27.88764355, - 29.913711925), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr"))), class = c("distribution", - "vctrs_vctr", "list"))), row.names = c(NA, -30L), class = c("tbl_df", - "tbl", "data.frame")) + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(0, 579.250000000001, 1838.75, 2963.25, 5057.91666666667, + 6361.33333333333, 7919), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr"))), class = c("distribution", "vctrs_vctr", + "list"))), row.names = c(NA, -30L), class = c("tbl_df", "tbl", + "data.frame")) --- @@ -1636,829 +1621,768 @@ 19017, 19017, 19018, 19018, 19018, 19018, 19018, 19018, 19019, 19019, 19019, 19019, 19019, 19019, 19020, 19020, 19020, 19020, 19020, 19020, 19021, 19021, 19021, 19021, 19021, 19021, 19022, - 19022, 19022, 19022, 19022, 19022), class = "Date"), .pred = c(101.37020155, - 52.0218521, 62.8203618, 73.403801, 65.16337705, 61.26228355, - 101.6955195, 59.319734, 64.149558, 76.1701803, 64.8717008, 62.1894199, - 101.4527557, 62.0988778, 68.7867389, 78.77218, 64.20397455, 62.69179115, - 101.2099919, 62.7667137, 75.1419375, 79.0270607, 63.5362483, - 63.2087591, 101.12743775, 63.1039182, 75.78419345, 78.742998, - 63.10376285, 63.8527187, 101.0448836, 63.4411227, 76.2677194, - 78.4589353, 62.6712774, 64.866949, 100.88485545, 64.19703935, - 77.2167642, 78.24801225, 61.857713, 67.0637587, 100.7248273, - 64.952956, 78.165809, 78.0370892, 61.5436861, 69.4590841, 100.02084865, - 64.19703935, 78.3985684, 77.4833701, 59.9076171, 69.5145517, - 99.31687, 63.4411227, 78.6313278, 76.929651, 58.2402571, 69.5700193, - 100.02084865, 63.1039182, 78.72936685, 76.54991565, 58.0078102, - 70.04879245, 99.31687, 62.7667137, 78.6313278, 76.1701803, 57.919525, - 70.5275656, 100.167269, 62.36574925, 78.3985684, 75.3593641, - 57.55465035, 72.25290055, 101.0448836, 61.9647848, 78.165809, - 74.5485479, 57.5540916, 73.9782355, 101.12743775, 61.69791335, - 77.2167642, 74.41482785, 57.4451321, 74.43462695, 101.2099919, - 61.4310419, 76.2677194, 74.2811078, 57.3361726, 74.8910184, 101.0448836, - 61.4310419, 76.2677194, 74.2811078, 54.230547, 73.9782355, 97.9375799, - 61.4310419, 76.2677194, 74.2811078, 52.5229559, 70.5275656, 93.4734845, - 59.6155274, 75.3006675, 74.2811078, 51.1182163, 70.5275656, 88.3355291, - 56.276348, 73.214503, 74.2811078, 48.9110877, 69.5700193, 82.4903292, - 54.9117542, 72.5102224, 74.2811078, 46.0926682, 69.4590841, 75.3837738, - 54.3550052, 71.3284182, 74.0749869, 45.2947493, 69.244512, 68.7398847, - 52.4067123, 70.0212307, 71.2786868, 44.2308575, 69.244512, 62.5379781, - 52.2805071, 69.4183239, 69.7745211, 43.9738248, 68.2670168, 61.091556, - 51.8545645, 67.9150583, 68.8059744, 43.8218402, 67.996004, 57.9203863, - 51.7086397, 67.5469116, 67.743602, 43.7547882, 67.3274732, 55.6730978, - 51.3826096, 66.5278389, 66.5017049, 43.4921678, 67.1732343, 54.4077507, - 49.40408, 65.3006833, 65.9446612, 42.5970235, 66.8477269, 53.3949649, - 48.4509678, 64.2362592, 65.8523132, 41.9745574, 64.6251297, 52.1648167, - 48.4279616, 61.8139608, 63.8332146, 40.8290856, 63.945408, 50.5057495, - 47.2796257, 58.2898901, 63.0818705, 40.4021878, 62.0818906), - .pred_distn = structure(list(structure(list(values = c(55.804902835, - 69.68485497, 91.052146075, 101.37020155, 120.408758675, 144.049577316667, - 159.65571585), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(6.45655338499999, - 20.33650552, 41.703796625, 52.0218521, 71.060409225, 94.7012278666667, - 110.3073664), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(17.255063085, - 31.13501522, 52.502306325, 62.8203618, 81.858918925, 105.499737566667, - 121.1058761), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(27.838502285, - 41.71845442, 63.085745525, 73.403801, 92.442358125, 116.083176766667, - 131.6893153), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(19.598078335, - 33.47803047, 54.845321575, 65.16337705, 84.201934175, 107.842752816667, - 123.44889135), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(15.696984835, - 29.57693697, 50.944228075, 61.26228355, 80.300840675, 103.941659316667, - 119.54779785), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(59.13969995, - 72.85921385, 91.009447025, 101.6955195, 120.195629141667, - 143.396761416667, 159.12550815), quantile_levels = c(0.05, + 19022, 19022, 19022, 19022, 19022), class = "Date"), .pred = c(37365.5, + 13073.5, 7959, 14445.5, 8805.5, 15877, 37403, 13147, 8193, 14704, + 8780, 15883, 37760.5, 13073.5, 8564.5, 15320, 8615.5, 16014, + 37403, 13147, 8596, 14791, 8497, 16145, 37365.5, 13433.5, 8564.5, + 14747.5, 8432.5, 16289, 37403, 13720, 8596, 14704, 8368, 16145, + 37723, 13433.5, 8816, 14445.5, 8276, 16289, 37328, 13147, 8533, + 14187, 7895, 16433, 37297.5, 13433, 8453.5, 14445.5, 7460, 16535, + 37267, 13719, 8533, 14704, 7282, 17337, 37297.5, 13719.5, 8564.5, + 14445.5, 7297.5, 17515.5, 37056, 12873, 8533, 14187, 6899, 17694, + 37161.5, 12593, 8463, 14183, 6828, 18626.5, 36895, 12313, 8393, + 14179, 6757, 19574, 35681.5, 12312, 8283.5, 14044, 6644, 19309.5, + 35263, 12119, 8150, 13909, 6531, 19574, 31371, 12311, 8068, 13908, + 5863, 19574, 29874, 12119, 8068, 13783, 5817, 19574, 25888, 12119, + 8068, 13783, 5817, 22350, 25816, 12119, 8068, 13783, 5817, 22580, + 24774, 11914, 7686, 13783, 5785, 22350, 24299, 11576, 7629, 13694, + 5662, 19574, 23250, 11543, 7454, 13410, 5632, 19112, 23168, 11423, + 7352, 12951, 5576, 19064, 21159, 11093, 6558, 12892, 5497, 18191, + 20459, 10976, 6384, 12721, 5379, 18191, 19778, 10533, 6343, 12383, + 5379, 18191, 19727, 9816, 6332, 11972, 5111, 17694, 18581, 9594, + 5706, 11492, 5058, 17565, 17672, 9535, 4961, 11209, 4470, 16433, + 17077, 8720, 4957, 11119, 4378, 15274), .pred_distn = structure(list( + structure(list(values = c(15120.675, 17284, 26354.875, 38594, + 47664.7916666667, 52739.7333333333, 54778.35), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(16.76391445, 30.48342835, 48.633661525, 59.319734, - 77.8198436416667, 101.020975916667, 116.74972265), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(21.59373845, 35.31325235, 53.463485525, 64.149558, - 82.6496676416667, 105.850799916667, 121.57954665), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(33.61436075, 47.33387465, 65.484107825, 76.1701803, - 94.6702899416667, 117.871422216667, 133.60016895), quantile_levels = c(0.05, + values = c(1689.5, 2761.25, 10682.2083333333, 14767.5, + 19231.1666666667, 38163.2166666667, 77743.35), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(22.31588125, 36.03539515, 54.185628325, 64.8717008, - 83.3718104416667, 106.572942716667, 122.30168945), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(19.63360035, 33.35311425, 51.503347425, 62.1894199, - 80.6895295416667, 103.890661816667, 119.61940855), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(62.40728398, 78.04363038, 89.9905976333334, - 101.4527557, 119.026258308333, 142.88478723, 157.987648545 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(23.05340608, 38.68975248, - 50.6367197333333, 62.0988778, 79.6723804083333, 103.53090933, - 118.633770645), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(29.74126718, - 45.37761358, 57.3245808333333, 68.7867389, 86.3602415083333, - 110.21877043, 125.321631745), quantile_levels = c(0.05, 0.1, + values = c(1939.4, 3574.16666666667, 6179.75, 8875, 11204.25, + 14841.9, 23963.6), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8982.55, + 10703.05, 12633.1666666667, 15049, 26771.5416666667, 51697.3666666667, + 74481.175), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4155.625, + 5136.7, 7467.04166666667, 9263.25, 10340, 13237.4666666667, + 17797.175), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8823.825, + 9956.8, 13291.5416666667, 15874, 21043.2916666667, 24114.0833333333, + 26033.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(15647, + 17595.3333333333, 28563.3333333333, 38798, 46091.3333333333, + 52616.1666666667, 53727.75), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(39.72670828, 55.36305468, 67.3100219333333, - 78.77218, 96.3456826083333, 120.20421153, 135.307072845 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(25.15850283, 40.79484923, - 52.7418164833333, 64.20397455, 81.7774771583333, 105.63600608, - 120.738867395), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(23.64631943, - 39.28266583, 51.2296330833333, 62.69179115, 80.2652937583333, - 104.12382268, 119.226683995), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(1763, 2706.5, 10664.0833333333, 14824, 19157.75, + 39535.1666666667, 77895.5), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(63.9611915, 78.8035023033333, 88.854864075, - 101.2099919, 118.207198825, 142.57565984, 157.337373165 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(25.5179133, 40.3602241033333, - 50.411585875, 62.7667137, 79.763920625, 104.13238164, 118.894094965 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(37.8931371, 52.7354479033333, - 62.786809675, 75.1419375, 92.139144425, 116.50760544, 131.269318765 + values = c(2126.5, 3652.66666666667, 7071.5, 9287, 11473.5, + 15675, 24256), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9204.5, + 10860, 12848.6666666667, 15312, 27405.9166666667, 53366.6666666667, + 75067.75), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4116.25, + 5101, 7299.91666666667, 9146, 10337, 13300.6666666667, 17890.25 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(41.7782603, 56.6205711033333, - 66.671932875, 79.0270607, 96.024267625, 120.39272864, 135.154441965 + "vctrs_vctr")), structure(list(values = c(9624.5, 11331, + 13673.1666666667, 15883, 21719.5, 24178.8333333333, 26047 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(26.2874479, 41.1297587033333, - 51.181120475, 63.5362483, 80.533455225, 104.90191624, 119.663629565 + "vctrs_vctr")), structure(list(values = c(17588.75, 19883.7166666667, + 30488.3333333333, 39255.25, 46582.7916666667, 52631.2166666667, + 53139.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1689.5, + 2504.75, 10865.4583333333, 14616, 19179.1666666667, 40760.1166666666, + 77900.65), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2451.1, + 4721, 7481.25, 9487.75, 11875.9166666667, 16645.6, 24685.9 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(25.9599587, 40.8022695033333, - 50.853631275, 63.2087591, 80.205966025, 104.57442704, 119.336140365 + "vctrs_vctr")), structure(list(values = c(9783.95, 11374.45, + 13401.6666666667, 16386.75, 28429.5, 55393.4666666666, 76011.825 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(65.95252258, 78.2259029966667, - 88.1360268333333, 101.12743775, 116.914585325, 140.37480679, - 156.763584085), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(27.92900303, - 40.2023834466667, 50.1125072833333, 63.1039182, 78.891065775, - 102.35128724, 118.740064535), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(40.60927828, 52.8826586966667, 62.7927825333333, - 75.78419345, 91.571341025, 115.03156249, 131.420339785 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(43.56808283, 55.8414632466667, - 65.7515870833333, 78.742998, 94.530145575, 117.99036704, - 134.379144335), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(27.92884768, - 40.2022280966667, 50.1123519333333, 63.10376285, 78.890910425, - 102.35113189, 118.739909185), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(28.67780353, 40.9511839466667, 50.8613077833333, - 63.8527187, 79.639866275, 103.10008774, 119.488865035 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(71.64318726, 79.0626539133333, - 87.712093725, 101.0448836, 116.117290991667, 138.57469487, - 156.653689055), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(34.03942636, - 41.4588930133333, 50.108332825, 63.4411227, 78.5135300916667, - 100.97093397, 119.049928155), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(46.86602306, 54.2854897133333, 62.934929525, - 76.2677194, 91.3401267916667, 113.79753067, 131.876524855 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(49.05723896, 56.4767056133333, - 65.126145425, 78.4589353, 93.5313426916667, 115.98874657, - 134.067740755), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(33.26958106, - 40.6890477133333, 49.338487525, 62.6712774, 77.7436847916667, - 100.20108867, 118.280082855), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(35.46525266, 42.8847193133333, 51.534159125, - 64.866949, 79.9393563916667, 102.39676027, 120.475754455 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(73.96720985, 79.2443040833333, - 86.6722945166667, 100.88485545, 114.464257225, 136.2687016, - 157.199207575), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(37.27939375, - 42.5564879833333, 49.9844784166667, 64.19703935, 77.776441125, - 99.5808855, 120.511391475), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(50.2991186, 55.5762128333333, 63.0042032666667, - 77.2167642, 90.796165975, 112.60061035, 133.531116325 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(51.33036665, 56.6074608833333, - 64.0354513166667, 78.24801225, 91.827414025, 113.6318584, - 134.562364375), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(34.9400674, - 40.2171616333333, 47.6451520666667, 61.857713, 75.437114775, - 97.24155915, 118.172065125), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_vctr")), structure(list(values = c(3937.875, 4926.3, + 7033.625, 9073.25, 10190, 13224.8666666667, 17844.325), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(40.1461131, 45.4232073333333, 52.8511977666667, - 67.0637587, 80.643160475, 102.44760485, 123.378110825 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + values = c(9736.85, 12282.2333333333, 13865.6666666667, + 16181.5, 22005.3333333333, 24368.5833333333, 26185.8), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(73.643164885, 79.18261424, - 86.8010077916667, 100.7248273, 113.532252125, 134.676285906667, - 157.3919414), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(17217, 19203.7666666667, + 31015.6666666667, 38798, 46015.8333333333, 51909.1333333333, + 52688.7), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(37.871293585, - 43.41074294, 51.0291364916667, 64.952956, 77.760380825, 98.9044146066667, - 121.6200701), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1763, + 2450, 11346.5, 14555, 19278.6666666667, 42132.0666666666, + 78052.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(51.084146585, - 56.62359594, 64.2419894916667, 78.165809, 90.973233825, 112.117267606667, - 134.8329231), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(3065.9, + 5031.56666666667, 7500, 9348.5, 11929.6666666667, 17276.2, + 24775.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.955426785, - 56.49487614, 64.1132696916667, 78.0370892, 90.844514025, - 111.988547806667, 134.7042033), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(34.462023685, 40.00147304, 47.6198665916667, - 61.5436861, 74.351110925, 95.4951447066667, 118.2108002 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(42.377421685, 47.91687104, - 55.5352645916667, 69.4590841, 82.266508925, 103.410542706667, - 126.1261982), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9218.4, + 10743.9, 12859.6666666667, 15320, 26741.1666666667, 56275.2666666666, + 75810.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(73.28789219, - 78.61548023, 86.37959655, 100.02084865, 112.542570958333, - 133.627430296667, 150.8689182), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(3805.5, + 4797.6, 7270.66666666667, 8863, 10079, 13195.0666666667, + 17844.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10945.4, + 12617.1333333333, 13976.1666666667, 16145, 22266.3333333333, + 24558.3333333333, 26324.6), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(37.46408289, 42.79167093, 50.55578725, 64.19703935, - 76.7187616583333, 97.8036209966667, 115.0451089), quantile_levels = c(0.05, + values = c(17274.1, 21016.35, 32230.1666666667, 38594, + 45406.5416666667, 51145.7666666667, 52663.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(51.66561194, 56.99319998, 64.7573163, 78.3985684, - 90.9202907083333, 112.005150046667, 129.24663795), quantile_levels = c(0.05, + values = c(2049.5, 2608.25, 11491.625, 14536.25, 19591.1666666667, + 43717.0166666667, 78417.95), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(50.75041364, 56.07800168, 63.842118, 77.4833701, - 90.0050924083333, 111.089951746667, 128.33143965), quantile_levels = c(0.05, + values = c(2908.725, 4969.51666666667, 7081, 9305.75, + 11809.75, 17843.8, 24802.7), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(33.17466064, 38.50224868, 46.266365, 59.9076171, - 72.4293394083333, 93.5141987466667, 110.75568665), quantile_levels = c(0.05, + values = c(9138.35, 10598.85, 12803.1666666667, 15274.5, + 24619.7916666666, 57642.5666666667, 76095.475), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(42.78159524, 48.10918328, 55.8732996, 69.5145517, - 82.0362740083333, 103.121133346667, 120.36262125), quantile_levels = c(0.05, + values = c(3999.425, 5285.61666666667, 7042.41666666667, + 8730.5, 10022, 13219.2666666667, 17898.475), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(72.71769726, 78.2236376733333, 85.7751456, - 99.31687, 111.522466358333, 132.57099059, 152.102902555 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + values = c(7178.9, 12501.0333333333, 14359.5833333333, + 16456.5, 22540.3333333333, 24761.0833333333, 26476.4), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(36.84194996, 42.3478903733333, - 49.8993983, 63.4411227, 75.6467190583333, 96.69524329, 116.227155255 + "vctrs_vctr")), structure(list(values = c(18249.15, 21827, + 33813, 38465, 45756.9166666667, 51330.4666666667, 52713.9 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(52.03215506, 57.5380954733333, - 65.0896034, 78.6313278, 90.8369241583333, 111.88544839, 131.417360355 + "vctrs_vctr")), structure(list(values = c(2336, 4320.63333333333, + 11671, 15128, 19903.6666666667, 45301.9666666667, 78783.1 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(50.33047826, 55.8364186733333, - 63.3879266, 76.929651, 89.1352473583333, 110.18377159, 129.715683555 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(31.64108436, 37.1470247733333, - 44.6985327, 58.2402571, 70.4458534583333, 91.49437769, 111.026289655 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(42.97084656, 48.4767869733333, - 56.0282949, 69.5700193, 81.7756156583333, 102.82413989, 122.356051855 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(74.060731605, 79.2556880033333, - 86.842200825, 100.02084865, 112.144647808333, 132.92181872, - 148.512935945), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(37.143801155, - 42.3387575533333, 49.925270375, 63.1039182, 75.2277173583333, - 96.00488827, 111.596005495), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_vctr")), structure(list(values = c(2814.55, 4970.46666666667, + 6961, 9348.5, 11876.5, 18474.4, 24892.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(52.769249805, 57.9642062033333, 65.550719025, - 78.72936685, 90.8531660083333, 111.63033692, 127.221454145 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(50.589798605, 55.7847550033333, - 63.371267825, 76.54991565, 88.6737148083333, 109.45088572, - 125.042002945), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(32.047693155, - 37.2426495533333, 44.829162375, 58.0078102, 70.1316093583333, - 90.90878027, 106.499897495), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(9058.3, 10453.8, 12848.6666666667, 15229, + 20189.75, 59009.8666666667, 76380.05), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(44.088675405, 49.2836318033333, 56.870144625, - 70.04879245, 82.1725916083333, 102.94976252, 118.540879745 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(73.987476725, 79.38104865, - 86.39207555, 99.31687, 111.788622791667, 132.43595765, 144.92386215 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(37.437320425, 42.83089235, - 49.84191925, 62.7667137, 75.2384664916667, 95.88580135, 108.37370585 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(53.301934525, 58.69550645, - 65.70653335, 78.6313278, 91.1030805916667, 111.75041545, - 124.23831995), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.840787025, - 56.23435895, 63.24538585, 76.1701803, 88.6419330916667, 109.28926795, - 121.77717245), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(32.590131725, - 37.98370365, 44.99473055, 57.919525, 70.3912777916667, 91.03861265, - 103.52651715), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(45.198172325, - 50.59174425, 57.60277115, 70.5275656, 82.9993183916667, 103.64665325, - 116.13455775), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(75.956605975, - 80.9596484733333, 88.539361275, 100.167269, 112.632473483333, - 133.00282866, 140.02468224), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(3882.15, 5102.46666666667, 7407.91666666667, + 8598, 9965, 13243.4666666667, 17952.55), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(38.155086225, 43.1581287233333, 50.737841525, - 62.36574925, 74.8309537333333, 95.20130891, 102.22316249 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(54.187905375, 59.1909478733333, - 66.770660675, 78.3985684, 90.8637728833333, 111.23412806, - 118.25598164), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(51.148701075, - 56.1517435733333, 63.731456375, 75.3593641, 87.8245685833333, - 108.19492376, 115.21677734), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(5065.8, 10654.6, 14088.3333333333, 16145, + 22526.3333333333, 24675.8333333333, 26340.2), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(33.343987325, 38.3470298233333, 45.926742625, - 57.55465035, 70.0198548333333, 90.39021001, 97.41206359 + values = c(18378.125, 23946.75, 34085.9166666667, 38440, + 46298.0833333333, 51797.6666666667, 53046.5), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2049.5, 3323.08333333333, 11245.5416666667, + 14536.25, 19578.1666666667, 46313.9166666667, 78575.25 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(48.042237525, 53.0452800233333, - 60.624992825, 72.25290055, 84.7181050333333, 105.08846021, - 112.11031379), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(77.149265375, - 82.22193559, 90.573646025, 101.0448836, 112.896123383333, - 132.884684393333, 140.681032895), quantile_levels = c(0.05, + "vctrs_vctr")), structure(list(values = c(2908.875, 5159.91666666667, + 7635.5, 9557.25, 12127.4166666667, 19293.5, 25171), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(38.069166575, 43.14183679, 51.493547225, 61.9647848, - 73.8160245833333, 93.8045855933333, 101.600934095), quantile_levels = c(0.05, + values = c(8763.25, 10093.75, 12466.6666666667, 14820.75, + 19597.125, 60162.1666666667, 76449.625), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(54.270190775, 59.34286099, 67.694571425, 78.165809, - 90.0170487833333, 110.005609793333, 117.801958295), quantile_levels = c(0.05, + values = c(3737.375, 4868.16666666667, 7476.95833333333, + 8504, 9882.25, 13240.1666666667, 17979.125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(50.652929675, 55.72559989, 64.077310325, 74.5485479, - 86.3997876833333, 106.388348693333, 114.184697195), quantile_levels = c(0.05, + values = c(5186, 10656.6666666667, 14614.0833333333, + 16456.5, 22796.4166666667, 24878.5833333333, 26194.25 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(17792.1, 23584.4, + 34696.3333333333, 37700, 45940.8333333333, 51549.8666666667, + 52664.1), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1763, + 2325.53333333333, 10927.6666666667, 14444, 18899, 47084.8333333333, + 78367.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2500.2, + 4846.36666666667, 7201, 9054, 11597, 19609.6, 24946.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(8468.2, 9733.7, 12490.3333333333, 14412.5, + 18159.1666666667, 61314.4666666666, 76519.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(33.658473375, 38.73114359, 47.082854025, 57.5540916, - 69.4053313833333, 89.3938923933333, 97.190240895), quantile_levels = c(0.05, + values = c(3303.6, 4344.86666666667, 6860.33333333333, + 8121, 9494, 12947.8666666667, 17716.7), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(50.082617275, 55.15528749, 63.506997925, 73.9782355, - 85.8294752833333, 105.818036293333, 113.614384795), quantile_levels = c(0.05, + values = c(5306.2, 10536.8666666667, 14875.5, 16768, + 22554.3333333333, 24503.8, 26405.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(77.541498075, 82.84247276, 91.3108666166667, - 101.12743775, 112.919557791667, 132.597820013333, 138.915465815 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(38.111973675, 43.41294836, - 51.8813422166667, 61.69791335, 73.4900333916667, 93.1682956133333, - 99.485941415), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + values = c(21179.575, 27946.8, 35521.875, 37551.5, 45948.0833333333, + 51644.65, 52646.2), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2049, + 2134.55, 11182.2916666667, 14785.5, 18669.375, 32430.8333333333, + 74394.4249999998), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(53.630824525, - 58.93179921, 67.4001930666667, 77.2167642, 89.0088842416667, - 108.687146463333, 115.004792265), quantile_levels = c(0.05, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2295.025, + 4736, 6970, 8946.5, 10869.5833333333, 20062.9333333333, 24925.3 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(8690.15, 9904.06666666667, + 12897.4583333333, 14820.75, 17735.6666666667, 62814, 77105.775 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(2815.825, 3811.6, + 6189.70833333333, 7545.25, 8971.58333333333, 12665.75, 17400.275 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(5384.4, 10307.2, + 14993.3333333333, 17079.5, 22786.3333333333, 24661.5, 26574.95 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(23686.1, 29890.3333333333, + 36037.5833333333, 37639, 45594.5, 51695.6, 52628.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(50.828888175, 56.12986286, 64.5982567166667, - 74.41482785, 86.2069478916667, 105.885210113333, 112.202855915 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(33.859192425, 39.16016711, - 47.6285609666667, 57.4451321, 69.2372521416667, 88.9155143633333, - 95.233160165), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.848687275, - 56.14966196, 64.6180558166667, 74.43462695, 86.2267469916667, - 105.905009213333, 112.222655015), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(2335, 8574.13333333333, 11670, 15016, 19161.25, + 34376.8333333333, 76204.95), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(76.872366945, 83.17028771, 91.1412068166667, - 101.2099919, 111.069035908333, 126.05282846, 137.02913753 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(37.093416945, 43.39133771, - 51.3622568166667, 61.4310419, 71.2900859083333, 86.2738784599999, - 97.25018753), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(51.930094445, - 58.22801521, 66.1989343166667, 76.2677194, 86.1267634083333, - 101.11055596, 112.08686503), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(4542.5, 5090.76666666667, 7411.5, 9054, 10206.5, + 20542.7333333333, 25063.2), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(49.943482845, 56.24140361, 64.2123227166667, - 74.2811078, 84.1401518083333, 99.1239443599999, 110.10025343 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + values = c(9631.3, 11063.1, 13253.25, 15233, 18060.6666666667, + 63974, 77692.35), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2585.05, + 3623.4, 5776.08333333333, 7437, 8829.83333333333, 12769, + 17340.85), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(6162.6, + 10641.8, 15740.8333333333, 18091, 23718.3333333333, 25543, + 27444.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(30252.8, + 32915.3666666667, 36254.9166666667, 38394, 45981.375, 51807.55, + 52671.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9537.9, + 9937.15, 12300.375, 15072, 19342.125, 36037.3333333332, 77729.9749999999 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(4872.775, 5220.11666666667, + 7384, 9190, 10347.0833333333, 20974.5333333333, 25153.1), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(32.998547645, 39.29646841, - 47.2673875166667, 57.3361726, 67.1952166083333, 82.1790091599999, - 93.15531823), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(9342.15, 10703.05, + 12914.2083333333, 14972.5, 17602.6666666667, 51697.3666666666, + 71077.75), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.553393445, - 56.85131421, 64.8222333166667, 74.8910184, 84.7500624083333, - 99.7338549599999, 110.71016403), quantile_levels = c(0.05, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2547.775, + 3628.7, 6498.45833333333, 7488, 8876.25, 13065.75, 17474.925 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(6317.3, 9938.13333333333, + 15833.75, 18726.25, 24022.9166666667, 25801, 27690.15), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(76.21678654, 82.90804183, 91.1486652083333, - 101.0448836, 111.104262633333, 123.740168563333, 137.39764222 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + values = c(29958, 32458.6666666667, 35934.8333333333, + 37428, 43582.8333333333, 50394.6666666667, 52442.5), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(36.60294484, 43.29420013, - 51.5348235083333, 61.4310419, 71.4904209333333, 84.1263268633333, - 97.78380052), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(51.43962234, - 58.13087763, 66.3715010083333, 76.2677194, 86.3270984333333, - 98.9630043633333, 112.62047802), quantile_levels = c(0.05, + "vctrs_vctr")), structure(list(values = c(8688, 9047, 11108.5, + 13761, 17358, 36850.8333333333, 78407.9999999998), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(49.45301074, 56.14426603, 64.3848894083333, - 74.2811078, 84.3404868333333, 96.9763927633333, 110.63386642 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + values = c(4826, 5325.16666666667, 7201, 9054, 10196, + 16015, 24012), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9053, + 10343, 12969.5, 14712, 16784.6666666667, 52849.6666666666, + 71269.9999999999), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2096.5, + 3220, 5888.33333333333, 7054, 8374.33333333333, 12948.5, + 17195), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(5839, 6789.33333333333, + 15657.6666666667, 18448, 24319.6666666667, 26059, 27936), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(29.40244994, 36.09370523, - 44.3343286083333, 54.230547, 64.2899260333333, 76.9258319633333, - 90.58330562), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(30607.125, 33678.5333333333, + 36115.4166666667, 37878.5, 43922.9583333333, 50647.3666666667, + 52658.475), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(49.15013844, - 55.84139373, 64.0820171083333, 73.9782355, 84.0376145333333, - 96.6735204633333, 110.33099412), quantile_levels = c(0.05, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8024.5, + 9556.51666666667, 11098.125, 13435.75, 16089.7916666667, + 38230.8333333333, 80193.9249999997), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(73.774370035, 78.59141999, 88.0563121083333, - 97.9375799, 108.6317374, 121.075797326667, 135.25260137 + values = c(5046.225, 5518.03333333333, 7354.25, 9088.5, + 10131.25, 16180.0166666666, 24000.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(9594.8, 11154.35, 12957.0833333333, 14552.5, + 16489.0833333333, 38163.1333333332, 71594.075), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2009.6, 4206.96666666667, 6289.79166666667, + 6913.25, 8092.08333333333, 12020.8833333333, 17221.775 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(37.267832035, 42.08488199, - 51.5497741083333, 61.4310419, 72.1251994, 84.5692593266667, - 98.74606337), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(6711.15, 7674.23333333333, + 17084.8333333333, 20974, 25858.2916666667, 27071, 29131.7 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(29818.25, 33388.7333333333, + 35722.6666666667, 37267, 43891.0833333333, 50528.0666666667, + 52502.45), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(52.104509535, - 56.92155949, 66.3864516083333, 76.2677194, 86.9618769, 99.4059368266667, - 113.58274087), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.117897935, - 54.93494789, 64.3998400083333, 74.2811078, 84.9752653, 97.4193252266667, - 111.59612927), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(7293, + 9881.46666666667, 10905.25, 13110.5, 14594.8333333333, 25262.2666666667, + 81979.8500000001), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(28.359746035, - 33.17679599, 42.6416881083333, 52.5229559, 63.2171134, 75.6611733266667, - 89.83797737), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(5252.95, + 5738.8, 7321.91666666667, 8914, 10045.1666666667, 12559.0666666667, + 23988.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(46.364355735, - 51.18140569, 60.6462978083333, 70.5275656, 81.2217231, 93.6657830266667, - 107.84258707), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(69.34739278, - 72.7427495666667, 83.4242080833333, 93.4734845, 103.991254691667, - 116.04353109, 130.98286112), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10571.95, + 11564, 12882.8333333333, 14393, 16413.5, 19531.1, 71918.15 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(2996.25, 4994.6, + 6476.5, 6912, 7750.16666666667, 9530.6, 17248.55), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(35.48943568, 38.8847924666667, 49.5662509833333, - 59.6155274, 70.1332975916667, 82.18557399, 97.12490402 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + values = c(7598.3, 8574.13333333334, 17985.25, 22350, + 26930.4166666667, 28098, 30342.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(28082.375, 32151.9333333333, 34478.7916666667, + 36398.5, 41973.7083333333, 48010.3, 50161.475), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(6840.5, 9856.36666666667, 10891.5, 13154.75, + 14498.5833333333, 18771.2666666667, 44017.8499999999), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(51.17457578, 54.5699325666667, - 65.2513910833333, 75.3006675, 85.8184376916667, 97.87071409, - 112.81004412), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + "vctrs_vctr")), structure(list(values = c(5128.925, 5594.2, + 7200.25, 8776.5, 9917.58333333333, 11511.8666666667, 14721.475 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(11253.775, 11834.0666666667, + 12958.5833333333, 14413.5, 16319.4166666667, 18530.2166666667, + 28316.6749999999), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.15501608, - 53.5503728666667, 64.2318313833333, 74.2811078, 84.7988779916667, - 96.85115439, 111.79048442), quantile_levels = c(0.05, 0.1, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2825.375, + 4865.4, 6324.54166666667, 6729.25, 7712.58333333333, 8872.43333333333, + 11120.125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(7273.45, + 8262.03333333333, 17576.0416666667, 21657, 26292.0416666667, + 27403.6333333333, 29196.15), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(26.99212458, 30.3874813666667, 41.0689398833333, - 51.1182163, 61.6359864916667, 73.68826289, 88.62759292 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(46.40147388, 49.7968306666667, - 60.4782891833333, 70.5275656, 81.0453357916667, 93.09761219, - 108.03694222), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(64.40363552, - 66.9533907966667, 77.5947525166667, 88.3355291, 98.9597954916667, - 111.033447776667, 126.36324447), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(31164.6, 32212.2, 34218.6666666667, 36394, + 41789.8333333333, 47733.4, 49796.3), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(32.34445442, 34.8942096966667, 45.5355714166667, - 56.276348, 66.9006143916667, 78.9742666766667, 94.30406337 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(49.28260942, 51.8323646966667, - 62.4737264166667, 73.214503, 83.8387693916667, 95.9124216766667, - 111.24221837), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.34921422, - 52.8989694966667, 63.5403312166667, 74.2811078, 84.9053741916667, - 96.9790264766667, 112.30882317), quantile_levels = c(0.05, + values = c(6196, 9639.26666666667, 10661, 13007, 14063.6666666667, + 17858.4, 21143.1), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4980.9, + 5425.6, 7054, 8615, 9759, 10855.6, 11832.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(24.97919412, 27.5289493966667, 38.1703111166667, - 48.9110877, 59.5353540916667, 71.6090063766667, 86.93880307 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(45.63812572, 48.1878809966667, - 58.8292427166667, 69.5700193, 80.1942856916667, 92.2679379766667, - 107.59773467), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(58.360799175, - 61.0400563633333, 70.6001161083333, 82.4903292, 92.695819575, - 104.93632075, 121.19526997), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(11076.7, 11603.8666666667, 13055.6666666667, + 14434, 16025, 17239.0666666667, 19112.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2654.5, 4736.2, 6102.16666666667, 6546.5, + 7697.33333333333, 8805.13333333333, 9804.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(30.782224175, 33.4614813633333, 43.0215411083333, - 54.9117542, 65.117244575, 77.35774575, 93.61669497), + values = c(7477.6, 8478.93333333333, 17537.6666666667, + 22205, 26681.1666666667, 27669.7333333333, 29791.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(48.380692375, 51.0599495633333, - 60.6200093083333, 72.5102224, 82.715712775, 94.95621395, - 111.21516317), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.151577775, - 52.8308349633333, 62.3908947083333, 74.2811078, 84.486598175, - 96.72709935, 112.98604857), quantile_levels = c(0.05, 0.1, + "vctrs_vctr")), structure(list(values = c(27272.6, 28320.2, + 30326.6666666667, 32502, 36595, 42426.2, 45904.3), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(9452.4, 10020.5333333333, 10904, 13608, 14529.3333333333, + 18556.1333333333, 21335.1), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(4898.9, 5343.6, 6972, 8533, 9597, 10012.9333333333, + 11750.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(11075.7, + 11602.8666666667, 13054.6666666667, 14433, 15828.6666666667, + 17238.0666666667, 19111.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(21.963138175, 24.6423953633333, 34.2024551083333, - 46.0926682, 56.298158575, 68.53865975, 84.79760897), + values = c(1986.5, 4068.2, 5444.16666666667, 6018, 7084.66666666667, + 8137.13333333333, 9136.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(7477.6, 8478.93333333333, 17537.6666666667, + 22350, 26681.1666666667, 27669.7333333333, 29791.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(45.329554075, 48.0088112633333, - 57.5688710083333, 69.4590841, 79.664574475, 91.90507565, - 108.16402487), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(51.08691667, - 53.3456512033333, 61.6880369333333, 75.3837738, 85.4781493083333, - 97.4282297266667, 112.904404715), quantile_levels = c(0.05, + "vctrs_vctr")), structure(list(values = c(25775.6, 26823.2, + 28829.6666666667, 30936, 33217, 40929.2, 44407.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(30.05814807, 32.3168826033333, 40.6592683333333, - 54.3550052, 64.4493807083333, 76.3994611266667, 91.875636115 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(47.03156107, 49.2902956033333, - 57.6326813333333, 71.3284182, 81.4227937083333, 93.3728741266667, - 108.849049115), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(49.77812977, - 52.0368643033333, 60.3792500333333, 74.0749869, 84.1693624083333, - 96.1194428266667, 111.595617815), quantile_levels = c(0.05, + values = c(9260.4, 9828.53333333333, 10712, 13007, 14063.6666666667, + 17858.4, 18492), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4898.9, + 5343.6, 6869, 8533, 9597, 10012.9333333333, 11750.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(20.99789217, 23.2566267033333, 31.5990124333333, - 45.2947493, 55.3891248083333, 67.3392052266667, 82.815380215 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + values = c(10950.7, 11477.8666666667, 12929.6666666667, + 13997, 15703.6666666667, 17113.0666666667, 18986.6), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(44.94765487, 47.2063894033333, - 55.5487751333333, 69.244512, 79.3388875083333, 91.2889679266667, - 106.765142915), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(44.25108899, - 47.5210664066667, 55.509026825, 68.7398847, 79.2666461916667, - 90.27594772, 104.8739276), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(27.91791659, 31.1878940066667, 39.175854425, - 52.4067123, 62.9334737916667, 73.94277532, 88.5407552 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + "vctrs_vctr")), structure(list(values = c(1940.5, 4022.2, + 5559, 5972, 7038.66666666667, 8091.13333333333, 9090.8), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(45.53243499, 48.8024124066667, - 56.790372825, 70.0212307, 80.5479921916667, 91.55729372, - 106.1552736), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(7477.6, 9930.13333333334, + 17537.6666666667, 22350, 26681.1666666667, 27669.7333333333, + 29791.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(46.78989109, - 50.0598685066667, 58.047828925, 71.2786868, 81.8054482916667, - 92.81474982, 107.4127297), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(22459.4, + 23770.6666666667, 24843.6666666667, 26950, 29231, 36943.2, + 40421.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9153.2, + 9828.53333333333, 10712, 13007, 14063.6666666667, 17858.4, + 18492), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(4898.9, 5776.73333333333, + 6869, 8533, 9597, 10012.9333333333, 11750.9), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(19.74206179, 23.0120392066667, 30.999999625, - 44.2308575, 54.7576189916667, 65.76692052, 80.3649004 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(44.75571629, 48.0256937066667, - 56.013654125, 69.244512, 79.7712734916667, 90.78057502, 105.3785549 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(38.468745595, 41.4398087666667, - 49.05976785, 62.5379781, 73.1851803333333, 84.55503968, 96.5676217799999 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(28.211274595, 31.1823377666667, - 38.80229685, 52.2805071, 62.9277093333333, 74.29756868, 86.31015078 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(45.349091395, 48.3201545666667, - 55.94011365, 69.4183239, 80.0655261333333, 91.43538548, 103.44796758 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(45.705288595, 48.6763517666667, - 56.29631085, 69.7745211, 80.4217233333333, 91.79158268, 103.80416478 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(19.904592295, 22.8756554666667, - 30.49561455, 43.9738248, 54.6210270333333, 65.99088638, 78.00346848 + values = c(10950.7, 12188, 12929.6666666667, 13997, 15703.6666666667, + 17113.0666666667, 18986.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3386.1, 4144.46666666667, 5559, 5972, 7038.66666666667, + 8091.13333333333, 9090.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(10253.6, 12706.1333333333, 20313.6666666667, + 25818, 29848, 31033, 38341.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(22387.4, 23437.6666666667, 24717.6666666667, + 26878, 29159, 36871.2, 40349.3), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(9153.2, 9828.53333333333, 10785.5, 13416, + 14261, 17858.4, 18492), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(5472.2, 6260.8, 6972, 8533, 9597, 10012.9333333333, + 11750.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(11600.6, + 12188, 12929.6666666667, 13997, 15703.6666666667, 17113.0666666667, + 18986.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4108.6, + 4173.2, 5559, 5972, 7038.66666666667, 8091.13333333333, 9090.8 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(44.197784295, 47.1688474666667, - 54.78880655, 68.2670168, 78.9142190333333, 90.28407838, 102.29666048 + "vctrs_vctr")), structure(list(values = c(10483.6, 12936.1333333333, + 20543.6666666667, 26418, 30210.6666666667, 31670.8, 38571.6 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(37.10558333, 41.02744724, - 47.4004852416667, 61.091556, 72.4254332, 84.1693834866667, - 92.43304734), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(27.86859183, - 31.79045574, 38.1634937416667, 51.8545645, 63.1884417, 74.9323919866667, - 83.19605584), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(21345.4, 22418.3333333333, + 23729.6666666667, 25836, 28117, 35829.2, 39307.3), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(8948.2, 9623.53333333333, 10580.5, 12802, + 14056, 17653.4, 18287), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(5090.2, 5878.8, 6590, 8120, 9142.33333333333, + 9630.93333333333, 11368.9), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(11098, 11842.3333333333, 12929.6666666667, + 13997, 15703.6666666667, 17113.0666666667, 18986.6), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(4076.6, 4141.2, + 5500.33333333333, 5800.5, 7006.66666666667, 8059.13333333333, + 9058.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(43.92908563, - 47.85094954, 54.2239875416667, 67.9150583, 79.2489355, 90.9928857866667, - 99.25654964), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10253.6, + 12706.1333333333, 20313.6666666667, 26030, 29848, 31033, + 33266.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(44.82000173, - 48.74186564, 55.1149036416667, 68.8059744, 80.1398516, 91.8838018866667, - 100.14746574), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(19.83586753, - 23.75773144, 30.1307694416667, 43.8218402, 55.1557174, 66.8996676866667, - 75.16333154), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(20870.4, + 21943.3333333333, 23254.6666666667, 25182, 27642, 35354.2, + 38832.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(44.01003133, - 47.93189524, 54.3049332416667, 67.996004, 79.3298812, 91.0738314866667, - 99.33749534), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8610.2, + 9285.53333333333, 10242.5, 11576, 13503.6666666667, 17315.4, + 17949), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(5033.2, 5821.8, + 6976.66666666667, 8094, 9179.33333333333, 9573.93333333333, + 11311.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(34.59870976, - 37.7426754566667, 43.8981963, 57.9203863, 68.6731234833333, - 80.3934972966666, 88.68986738), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(11009, + 11228.6666666667, 12538.3333333333, 13863, 15614.6666666667, + 17024.0666666667, 18897.6), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(28.38696316, 31.5309288566667, 37.6864497, - 51.7086397, 62.4613768833333, 74.1817506966666, 82.47812078 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(44.22523506, 47.3692007566667, - 53.5247216, 67.5469116, 78.2996487833333, 90.0200225966666, - 98.31639268), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(44.42192546, - 47.5658911566667, 53.721412, 67.743602, 78.4963391833333, - 90.2167129966666, 98.51308308), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(3953.6, 4018.2, 5284, 5630, 6725.66666666667, + 7936.13333333333, 8935.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(20.43311166, 23.5770773566667, 29.7325982, - 43.7547882, 54.5075253833333, 66.2278991966666, 74.52426928 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(44.00579666, 47.1497623566667, - 53.3052832, 67.3274732, 78.0802103833333, 89.8005841966666, - 98.09695428), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(32.159838105, - 36.8239848966667, 42.5094393666667, 55.6730978, 67.0349863833333, - 78.6437884066667, 87.524143305), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(7477.6, 9930.13333333334, 17537.6666666667, + 23042, 26681.1666666667, 28257, 30490.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(27.869349905, 32.5334966966667, 38.2189511666667, - 51.3826096, 62.7444981833333, 74.3533002066667, 83.233655105 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(43.014579205, 47.6787259966667, - 53.3641804666667, 66.5278389, 77.8897274833333, 89.4985295066667, - 98.378884405), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(42.988445205, - 47.6525919966667, 53.3380464666667, 66.5017049, 77.8635934833333, - 89.4723955066666, 98.352750405), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(19821.4, 20894.3333333333, 22205.6666666667, + 23879, 25537.3333333333, 32504.6, 35472.9), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(19.978908105, 24.6430548966667, 30.3285093666667, - 43.4921678, 54.8540563833333, 66.4628584066666, 75.343213305 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(43.659974605, 48.3241213966667, - 54.0095758666667, 67.1732343, 78.5351228833333, 90.1439249066667, - 99.024279805), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(30.24830983, - 35.25638107, 41.7706605333333, 54.4077507, 66.117754675, - 76.0960279766667, 85.573087805), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(8577.2, 9252.53333333333, 10209.5, 11543, + 13470.6666666667, 16077.6666666667, 17680.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(25.24463913, 30.25271037, 36.7669898333333, - 49.40408, 61.114083975, 71.0923572766667, 80.569417105 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(41.14124243, 46.14931367, - 52.6635931333333, 65.3006833, 77.010687275, 86.9889605766667, - 96.466020405), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(41.78522033, - 46.79329157, 53.3075710333333, 65.9446612, 77.654665175, - 87.6329384766667, 97.109998305), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(4858.2, 5646.8, 6801.66666666667, 7919, 9004.33333333333, + 9398.93333333333, 11136.9), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(18.43758263, 23.44565387, 29.9599333333333, - 42.5970235, 54.307027475, 64.2853007766667, 73.762360605 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + values = c(10725, 10944.6666666667, 12245.6666666667, + 13553, 15212.8333333333, 16319.9333333333, 18613.6), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(42.68828603, 47.69635727, - 54.2106367333333, 66.8477269, 78.557730875, 88.5360041766667, - 98.013064005), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(30.19260489, - 34.7388982466667, 42.2121990666667, 53.3949649, 66.2985149166667, - 76.15698156, 81.22226177), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(25.24860779, 29.7949011466667, 37.2682019666667, - 48.4509678, 61.3545178166667, 71.21298446, 76.27826467 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + "vctrs_vctr")), structure(list(values = c(3923.6, 3988.2, + 5254, 5600, 6695.66666666667, 7906.13333333333, 8905.8), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(41.03389919, 45.5801925466667, - 53.0534933666667, 64.2362592, 77.1398092166667, 86.99827586, - 92.06355607), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(7015.6, 9468.13333333334, + 17075.6666666667, 21888, 25737.6666666667, 27790.7333333333, + 30028.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(42.64995319, - 47.1962465466667, 54.6695473666667, 65.8523132, 78.7558632166667, - 88.61432986, 93.67961007), quantile_levels = c(0.05, 0.1, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(19739.4, + 20812.3333333333, 22123.6666666667, 23797, 25455.3333333333, + 30070.2333333333, 33469.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(18.77219739, 23.3184907466667, 30.7917915666667, - 41.9745574, 54.8781074166667, 64.73657406, 69.80185427 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + values = c(8457.2, 9132.53333333333, 10089.5, 11423, + 13183.3333333333, 14916.2, 16487.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(4756.2, 5544.8, 6699.66666666667, 7817, 8785, + 9005.33333333333, 9670.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(10266, 10485.6666666667, 11786.6666666667, + 13094, 14753.8333333333, 15439.2666666667, 16571), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3867.6, 3932.2, 5198, 5544, 6440.66666666667, + 7378.46666666667, 8283.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(6967.6, 9420.13333333334, 17027.6666666667, + 21695, 25185.3333333333, 27742.7333333333, 29980.4), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(41.42276969, 45.9690630466667, - 53.4423638666667, 64.6251297, 77.5286797166667, 87.38714636, - 92.45242657), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(30.22683433, - 34.9465693766667, 42.3338884, 52.1648167, 66.3757032333333, - 76.0204502733333, 80.92708679), quantile_levels = c(0.05, + "vctrs_vctr")), structure(list(values = c(17730.4, 18803.3333333333, + 20114.6666666667, 21531, 23113, 26977, 28884.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(26.48997923, 31.2097142766667, 38.5970333, - 48.4279616, 62.6388481333333, 72.2835951733333, 77.19023169 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(39.87597843, 44.5957134766667, - 51.9830325, 61.8139608, 76.0248473333333, 85.6695943733333, - 90.57623089), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + values = c(8127.2, 8802.53333333333, 9759.5, 11042, 12820.6666666667, + 14586.2, 16157.6), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(3962.2, + 4750.8, 5905.66666666667, 6992, 7636.66666666667, 8200.53333333333, + 8292.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(41.89523223, - 46.6149672766667, 54.0022863, 63.8332146, 78.0441011333333, - 87.6888481733333, 92.59548469), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10207, + 10426.6666666667, 11727.6666666667, 13035, 14644.3333333333, + 15178.4666666667, 16052), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(18.89110323, 23.6108382766667, 30.9981573, - 40.8290856, 55.0399721333333, 64.6847191733333, 69.59135569 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(42.00742563, 46.7271606766667, - 54.1144797, 63.945408, 78.1562945333333, 87.8010415733333, - 92.70767809), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + values = c(3788.6, 3853.2, 5119, 5465, 6173.33333333333, + 6873.33333333333, 7838.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(6094.6, 8547.13333333334, 15299, 20127, 23727.6666666667, + 26869.7333333333, 29107.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(17030.4, 18103.3333333333, 19360.6666666667, + 20459, 22413, 26277, 28184.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(8010.2, 8685.53333333333, 9642, 10925, 12703.6666666667, + 14469.2, 16040.6), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(3788.2, + 4576.8, 5346.33333333333, 6818, 7462.66666666667, 8026.53333333333, + 8118.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(29.53863982, - 33.1954511766667, 41.0448188583333, 50.5057495, 64.8038051083333, - 73.5802344266667, 78.079860825), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10036, + 10255.6666666667, 11556.6666666667, 12864, 14080.3333333333, + 15007.4666666667, 15881), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(26.31251602, 29.9693273766667, 37.8186950583333, - 47.2796257, 61.5776813083333, 70.3541106266667, 74.853737025 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + values = c(3670.6, 3735.2, 4809, 5266, 6055.33333333333, + 6755.33333333333, 7720.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(6094.6, 8547.13333333334, 15152, 20127, 23727.6666666667, + 26869.7333333333, 29107.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(16349.4, 17422.3333333333, 18679.6666666667, + 19778, 21732, 25596, 27503.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(7567.2, 8242.53333333333, 9379.66666666667, + 10482, 12260.6666666667, 14026.2, 15597.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3747.2, 4535.8, 5711.33333333333, 6777, 7421.66666666667, + 7985.53333333333, 8077.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(9698, 9917.66666666667, 11218.6666666667, + 12526, 13742.3333333333, 14669.4666666667, 15543), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3670.6, 3908, 5001, 5347, 6224.33333333333, + 6755.33333333333, 7720.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(6094.6, 8547.13333333334, 15152, 20127, 23727.6666666667, + 26869.7333333333, 29107.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(16298.4, 17371.3333333333, 18628.6666666667, + 19727, 21681, 25545, 27452.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(6850.2, 7525.53333333333, 8662.66666666667, + 9765, 11335.6666666667, 13275.3333333333, 14880.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3736.2, 4524.8, 5700.33333333333, 6714, 7410.66666666667, + 7974.53333333333, 8066.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(9287, 9506.66666666667, 10599, 11883, 13331.3333333333, + 14258.4666666667, 15132), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3402.6, 3640, 4733, 4998, 5853.66666666667, + 6487.33333333333, 7452.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(5597.6, 8050.13333333334, 14655, 19574, 22723.3333333333, + 26372.7333333333, 28610.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(15152.4, 16225.3333333333, 17482.6666666667, + 18581, 20535, 24399, 26306.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(6628.2, 7303.53333333333, 8440.66666666667, + 9543, 11013, 13053.3333333333, 14658.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3110.2, 3898.8, 5074.33333333333, 6140, 6784.66666666667, + 7348.53333333333, 7440.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(8807, 9026.66666666667, 10119, 11403, 13193.3333333333, + 13778.4666666667, 14652), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3349.6, 3587, 4680, 4945, 5712.66666666667, + 6263.53333333333, 7399.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(5468.6, 7921.13333333334, 14526, 19172, 21793.1666666667, + 26243.7333333333, 28481.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(14243.4, 15316.3333333333, 16573.6666666667, + 17672, 19117.3333333333, 21921.5333333333, 24647), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(6569.2, 7244.53333333333, 8381.66666666667, + 9484, 10946.6666666667, 12994.3333333333, 14599.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2365.2, 3153.8, 4329.33333333333, 5343, 6039.66666666667, + 6603.53333333333, 6695.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(8524, 8743.66666666667, 9836, 11120, 12910.3333333333, + 13495.4666666667, 14369), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2761.6, 2999, 4092, 4438, 5124.66666666667, + 5675.53333333333, 6811.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(4336.6, 6789.13333333334, 13394, 17898, 20165.6666666667, + 25111.7333333333, 27349.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(13648.4, 14721.3333333333, 15978.6666666667, + 17077, 18266, 19933.0666666667, 22864), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(5754.2, 6429.53333333333, 7566.66666666667, + 8669, 10050.3333333333, 10882.4, 13120.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2361.2, 3149.8, 4325.33333333333, 5270, 5878.66666666667, + 6580.4, 6683.8), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8434, + 8653.66666666667, 9746, 11030, 12458, 13329.8, 13463.8), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(37.32278042, 40.9795917766667, - 48.8289594583333, 58.2898901, 72.5879457083334, 81.3643750266667, - 85.864001425), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(42.11476082, - 45.7715721766667, 53.6209398583333, 63.0818705, 77.3799261083334, - 86.1563554266667, 90.655981825), quantile_levels = c(0.05, + "vctrs_vctr")), structure(list(values = c(2669.6, 2907, 4000, + 4346, 5032.66666666667, 5583.53333333333, 6719.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(19.43507812, 23.0918894766667, 30.9412571583333, - 40.4021878, 54.7002434083333, 63.4766727266667, 67.976299125 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(41.11478092, 44.7715922766667, - 52.6209599583333, 62.0818906, 76.3799462083334, 85.1563755266667, - 89.656001925), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr"))), class = c("distribution", - "vctrs_vctr", "list"))), row.names = c(NA, -186L), class = c("tbl_df", + values = c(3177.6, 5630.13333333334, 12235, 16653, 18812.6666666667, + 23952.7333333333, 26190.4), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr"))), class = c("distribution", + "vctrs_vctr", "list"))), row.names = c(NA, -186L), class = c("tbl_df", "tbl", "data.frame")) diff --git a/tests/testthat/test-snapshots.R b/tests/testthat/test-snapshots.R index fcbdf5f2..eb0439c1 100644 --- a/tests/testthat/test-snapshots.R +++ b/tests/testthat/test-snapshots.R @@ -196,7 +196,7 @@ test_that("climatological_forecaster snapshots", { # Compute quantiles separately by location, and a backcast backcast <- climatological_forecaster( - rates, "case_rate_7d_av", + rates, "cases", climate_args_list( quantile_by_key = "geo_value", forecast_date = as.Date("2021-06-01") @@ -206,8 +206,9 @@ test_that("climatological_forecaster snapshots", { # compute the climate "daily" rather than "weekly" # use a two week window (on both sides) daily_fcast <- climatological_forecaster( - rates, "case_rate_7d_av", + rates, "cases", climate_args_list( + quantile_by_key = "geo_value", time_type = "day", window_size = 14L, forecast_horizon = 0:30 ) ) From 08fcd0116ff16083f9f4ae780f3ac254445d919d Mon Sep 17 00:00:00 2001 From: "Daniel J. McDonald" Date: Wed, 19 Feb 2025 10:25:48 -0800 Subject: [PATCH 47/54] once more, FU styler --- R/climatological_forecaster.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index a5d92f09..8a584f58 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -138,7 +138,7 @@ climatological_forecaster <- function(epi_data, } climate_quantiles <- epi_data %>% left_join(climate_center, by = c(".idx", keys)) %>% - mutate({{outcome}} := !!sym_outcome - .pred) %>% + mutate({{ outcome }} := !!sym_outcome - .pred) %>% select(.idx, .weights, all_of(c(outcome, args_list$quantile_by_key))) %>% dplyr::reframe( roll_modular_multivec( From a5dea728b90788e43d32aba1aeca8e544c52713e Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Thu, 27 Feb 2025 13:39:06 -0600 Subject: [PATCH 48/54] step_climate leap weeks/days --- R/step_climate.R | 84 +++++++++++++++++++++++++----- tests/testthat/test-step_climate.R | 74 ++++++++++++++++++++++++-- 2 files changed, 142 insertions(+), 16 deletions(-) diff --git a/R/step_climate.R b/R/step_climate.R index 72f595e9..5bb2556a 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -179,10 +179,10 @@ step_climate <- arg_is_lgl_scalar(skip) time_aggr <- switch(time_type, - epiweek = lubridate::epiweek, - week = lubridate::isoweek, + epiweek = epiweek_leap, + week = isoweek_leap, month = lubridate::month, - day = lubridate::yday + day = yday_leap ) recipes::add_step( @@ -258,22 +258,31 @@ prep.step_climate <- function(x, training, info = NULL, ...) { wts <- wts %||% rep(1, nrow(training)) modulus <- switch(x$time_type, - epiweek = 53L, - week = 53L, + epiweek = 52L, # only sometimes true + week = 52L, month = 12L, - day = 365L + day = 365L # only sometimes true ) fn <- switch(x$center_method, mean = function(x, w) stats::weighted.mean(x, w, na.rm = TRUE), median = function(x, w) median(x, na.rm = TRUE) ) - - climate_table <- training %>% + # suppose it's week 52, and there is no week 53 this year; then + # as originally written for 1 week ahead this grabs from week 52+1 %% 53 + # which will be week 53, not week 1. + ahead_period <- switch(x$time_type, + epiweek = lubridate::weeks(x$forecast_ahead), + week = lubridate::weeks(x$forecast_ahead), + month = lubridate::months(x$forecast_ahead), + day = lubridate::days(x$forecast_ahead), + ) + climate_table <- + training %>% mutate( - .idx = x$time_aggr(time_value), .weights = wts, - .idx = (.idx - x$forecast_ahead) %% modulus, - .idx = dplyr::case_when(.idx == 0 ~ modulus, TRUE ~ .idx) + .idx = time_value %m-% ahead_period, + .idx = x$time_aggr(.idx), + .weights = wts ) %>% select(.idx, .weights, all_of(c(col_names, x$epi_keys))) %>% tidyr::pivot_longer(all_of(unname(col_names))) %>% @@ -341,8 +350,33 @@ roll_modular_multivec <- function(col, .idx, weights, aggr, window_size, modulus tidyr::nest(data = c(col, weights), .by = .idx) out <- double(nrow(tib)) for (iter in seq_along(out)) { - entries <- (iter - window_size):(iter + window_size) %% modulus + # +1 from 1-indexing + entries <- ((iter - window_size):(iter + window_size) %% modulus) entries[entries == 0] <- modulus + # note that because we are 1-indexing, we're looking for indices that are 1 + # larger than the actual day/week in the year + if (modulus == 365) { + # we need to grab just the window around the leap day on the leap day + if (iter == 366) { + entries <- ((60 - window_size):(60 + window_size - 1) %% modulus) + entries <- c(entries, 366) + } else if ((60 %in% entries) || (61 %in% entries)) { + # if we're on the Feb/March boundary for daily data, we need to add in the + # leap day data + entries <- c(entries, 366) + } + } else if (modulus == 52) { + # we need to grab just the window around the leap week on the leap week + if (iter == 53) { + entries <- ((53 - window_size):(53 + window_size - 1) %% 52) + entries[entries == 0] <- 52 + entries <- c(entries, 53) + } else if ((52 %in% entries) || (1 %in% entries)) { + # if we're on the year boundary for weekly data, we need to add in the + # leap week data (which is the extra week at the end) + entries <- c(entries, 53) + } + } out[iter] <- with( purrr::list_rbind(tib$data[entries]), aggr(col, weights) @@ -350,3 +384,29 @@ roll_modular_multivec <- function(col, .idx, weights, aggr, window_size, modulus } tibble(.idx = unique(tib$.idx), climate_pred = out) } + + +#' a function that assigns Feb 29th to -1, and aligns all other dates the same +#' number in the year, regardless of whether it's a leap year +#' @keywords internal +yday_leap <- function(time_value) { + ifelse( + !lubridate::leap_year(time_value), + lubridate::yday(time_value), + ifelse( + (lubridate::month(time_value) == 2) & lubridate::day(time_value) == 29, + 999, + lubridate::yday(time_value) - (lubridate::month(time_value) > 2) + ) + ) +} +#' epiweek, but it assigns week 53 the value of -1 instead so it mirrors the assignments in yday_leap +#' @keywords internal +epiweek_leap <- function(time_value) { + lubridate::epiweek(time_value) %>% ifelse(. == 53, 999, .) +} +#' isoweek, but it assigns week 53 the value of -1 instead so it mirrors the assignments in yday_leap +#' @keywords internal +isoweek_leap <- function(time_value) { + lubridate::isoweek(time_value) %>% ifelse(. == 53, 999, .) +} diff --git a/tests/testthat/test-step_climate.R b/tests/testthat/test-step_climate.R index 2544a77a..3fa0fd47 100644 --- a/tests/testthat/test-step_climate.R +++ b/tests/testthat/test-step_climate.R @@ -1,3 +1,17 @@ +test_that("yday_leap works", { + # feburary 29th is assigned a negative value + expect_equal(yday_leap(as.Date("2024-02-29")), 999) + # before that is normal + expect_equal(yday_leap(as.Date("2024-02-28")), 31 + 28) + + # after that is decreased by 1 (so matches non leap years) + expect_equal( + yday_leap(as.Date("2024-05-28")), + lubridate::yday(as.Date("2022-05-28")) + ) + # off leap years have the right value + expect_equal(yday_leap(as.Date("2023-05-28")), 31 + 28 + 31 + 30 + 28) +}) test_that("roll_modular_multivec works", { tib <- tibble( col = c(1, 2, 3, 3.5, 4, 1, -2, 4, 1, 0), @@ -72,7 +86,32 @@ test_that("prep/bake steps create the correct training data", { r <- epi_recipe(x) %>% step_climate(y, time_type = "epiweek") p <- prep(r, x) - expected_res <- tibble(.idx = 1:53, climate_y = c(2, 2:25, 25, 25, 25:2, 2, 2)) + expected_res <- tibble(.idx = c(1:52, 999), climate_y = c(2, 2:25, 25, 25, 25:2, 2, 2)) + expect_equal(p$steps[[1]]$climate_table, expected_res) + + b <- bake(p, new_data = NULL) + expected_bake <- x %>% + mutate(.idx = epiweek_leap(time_value)) %>% + left_join(expected_res, by = join_by(.idx)) %>% + select(-.idx) + expect_equal(b, expected_bake) +}) + + +test_that("prep/bake steps create the correct training data for non leapweeks", { + single_yr <- seq(as.Date("2023-01-01"), as.Date("2023-12-31"), by = "1 day") + x <- tibble( + time_value = rep(single_yr, times = 2L), + geo_value = rep(c("reg1", "reg2"), each = length(single_yr)), + # shift by 2 days to match the epiweeks of 2021 + y = rep(c(1, 1, rep(c(1:26, 26:2), each = 7), 1, 1, 1, 1, 1, 1), times = 2L) + ) %>% + as_epi_df() + # epiweeks 1, 52, and 53 are all 1, note that there are days in wk 52, 2 in wk 53 + r <- epi_recipe(x) %>% step_climate(y, time_type = "epiweek") + p <- prep(r, x) + + expected_res <- tibble(.idx = 1:52, climate_y = c(2, 2:25, 25, 25, 25:2, 2)) expect_equal(p$steps[[1]]$climate_table, expected_res) b <- bake(p, new_data = NULL) @@ -84,6 +123,34 @@ test_that("prep/bake steps create the correct training data", { }) + +test_that("prep/bake steps create the correct training data for daily data", { + single_yr <- seq(as.Date("2020-01-01"), as.Date("2020-12-31"), by = "1 day") + x <- tibble( + time_value = rep(single_yr, times = 2L), + geo_value = rep(c("reg1", "reg2"), each = length(single_yr)), + y = rep(c(1:183, 184:2), times = 2L) + ) %>% + as_epi_df() + # epiweeks 1, 52, and 53 are all 1, note that there are days in wk 52, 2 in wk 53 + r <- epi_recipe(x) %>% step_climate(y, time_type = "day") + p <- prep(r, x) + + expected_res <- tibble( + .idx = c(1:365, 999), + climate_y = c(3, 3, 3:(60 - 4), 57.5:64.5, 66:181, rep(182, 5), 181:3, 3, 60) + ) + expect_equal(p$steps[[1]]$climate_table, expected_res) + + b <- bake(p, new_data = NULL) + expected_bake <- x %>% + mutate(.idx = yday_leap(time_value)) %>% + left_join(expected_res, by = join_by(.idx)) %>% + select(-.idx) + expect_equal(b, expected_bake) +}) + + test_that("leading the climate predictor works as expected", { single_yr <- seq(as.Date("2021-01-01"), as.Date("2021-12-31"), by = "1 day") x <- tibble( @@ -102,10 +169,9 @@ test_that("leading the climate predictor works as expected", { step_epi_naomit() p <- prep(r, x) - expected_res <- tibble(.idx = 1:53, climate_y = c(2, 2:25, 25, 25, 25:2, 2, 2)) %>% + expected_res <- tibble(.idx = c(1:52, 999), climate_y = c(2, 2, 3, 4, 4.5, 5.5, 7:25, 25, 25, 25:2, 2, 2)) %>% mutate( - .idx = (.idx - 2L) %% 53, - .idx = dplyr::case_when(.idx == 0 ~ 53L, TRUE ~ .idx) + climate_y = climate_y[c(3:53, 1:2)] ) %>% arrange(.idx) expect_equal(p$steps[[3]]$climate_table, expected_res) From b3db00797b80a09ad7fb1bed1385bcb798b8735d Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Thu, 27 Feb 2025 16:48:26 -0600 Subject: [PATCH 49/54] same for climatological_forecaster --- R/climatological_forecaster.R | 6 +- tests/testthat/_snaps/snapshots.md | 1241 +++++++++-------- .../testthat/test-climatological_forecaster.R | 26 + 3 files changed, 651 insertions(+), 622 deletions(-) diff --git a/R/climatological_forecaster.R b/R/climatological_forecaster.R index 8a584f58..7df85325 100644 --- a/R/climatological_forecaster.R +++ b/R/climatological_forecaster.R @@ -100,15 +100,15 @@ climatological_forecaster <- function(epi_data, select(all_of(c(key_colnames(epi_data), outcome))) if (time_type %in% c("week", "epiweek")) { ttype_dur <- lubridate::weeks - time_aggr <- ifelse(time_type == "week", lubridate::epiweek, lubridate::isoweek) - modulus <- 53L + time_aggr <- ifelse(time_type == "week", epiweek_leap, isoweek_leap) + modulus <- 52L } else if (time_type == "month") { ttype_dur <- function(x) lubridate::period(month = x) time_aggr <- lubridate::month modulus <- 12L } else if (time_type == "day") { ttype_dur <- lubridate::days - time_aggr <- lubridate::yday + time_aggr <- yday_leap modulus <- 365L } center_fn <- switch(args_list$center_method, diff --git a/tests/testthat/_snaps/snapshots.md b/tests/testthat/_snaps/snapshots.md index 45223fa5..855cbb45 100644 --- a/tests/testthat/_snaps/snapshots.md +++ b/tests/testthat/_snaps/snapshots.md @@ -1297,135 +1297,142 @@ 18992, 18992, 18992, 18999, 18999, 18999, 18999, 18999, 18999, 19006, 19006, 19006, 19006, 19006, 19006, 19013, 19013, 19013, 19013, 19013, 19013, 19020, 19020, 19020, 19020, 19020, 19020 - ), class = "Date"), .pred = c(81.6909143, 46.9476797, 57.1427664, - 55.4893801, 64.9577509, 49.3180127, 92.3266162, 51.49632575, - 62.0313808, 69.29024775, 65.2064021, 60.734368, 97.9375799, 52.0734516, - 66.9333338, 70.0729902, 60.5814898, 62.3893953, 94.69837105, - 52.17697935, 69.7197773, 67.80972325, 57.0623769, 66.48962015, - 75.3837738, 51.3826096, 67.5469116, 65.9446612, 45.2947493, 67.3274732 - ), .pred_distn = structure(list(structure(list(values = c(58.912419115, - 63.8539116, 78.6221968916667, 87.443016025, 96.4306031625, 110.01340202, - 130.62914179), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(24.169184515, 29.110677, - 43.8789622916667, 52.699781425, 61.6873685625, 75.2701674200001, - 95.88590719), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(34.364271215, 39.3057637, - 54.0740489916667, 62.894868125, 71.8824552625, 85.4652541200001, - 106.08099389), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(32.710884915, 37.6523774, - 52.4206626916667, 61.241481825, 70.2290689625, 83.8118678200001, - 104.42760759), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(42.179255715, 47.1207482, - 61.8890334916667, 70.709852625, 79.6974397625, 93.2802386200001, - 113.89597839), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(26.539517515, 31.48101, - 46.2492952916667, 55.070114425, 64.0577015625, 77.6405004200001, - 98.25624019), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(70.0311977125, 75.2240245166667, - 91.1454313916667, 98.454914125, 107.373545891667, 123.554305783333, - 144.7359469125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(29.2009072625, 34.3937340666667, - 50.3151409416667, 57.624623675, 66.5432554416667, 82.7240153333334, - 103.9056564625), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(39.7359623125, 44.9287891166667, - 60.8501959916667, 68.159678725, 77.0783104916667, 93.2590703833334, - 114.4407115125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(46.9948292625, 52.1876560666667, - 68.1090629416667, 75.418545675, 84.3371774416667, 100.517937333333, - 121.6995784625), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(42.9109836125, 48.1038104166667, - 64.0252172916667, 71.334700025, 80.2533317916667, 96.4340916833333, - 117.6157328125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(38.4389495125, 43.6317763166667, - 59.5531831916667, 66.862665925, 75.7812976916667, 91.9620575833334, - 113.1436987125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(82.576852205, 90.8680012616667, - 96.763374925, 102.9301931, 111.617195108333, 125.002081223333, - 154.43090355), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(36.712723905, 45.0038729616667, - 50.899246625, 57.0660648, 65.7530668083333, 79.1379529233334, - 108.56677525), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(51.572606105, 59.8637551616667, - 65.759128825, 71.925947, 80.6129490083333, 93.9978351233334, - 123.42665745), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(54.712262505, 63.0034115616667, - 68.898785225, 75.0656034, 83.7526054083333, 97.1374915233334, - 126.56631385), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(45.220762105, 53.5119111616667, - 59.407284825, 65.574103, 74.2611050083333, 87.6459911233334, - 117.07481345), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(47.028667605, 55.3198166616667, - 61.215190325, 67.3820085, 76.0690105083333, 89.4538966233334, - 118.88271895), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(87.348649135, 89.0869120166667, - 93.3996244833333, 98.4483999, 106.692614608333, 116.011698185, - 127.641653255), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(44.827257435, 46.5655203166667, - 50.8782327833333, 55.9270082, 64.1712229083333, 73.490306485, - 85.120261555), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(62.370055385, 64.1083182666667, - 68.4210307333333, 73.46980615, 81.7140208583333, 91.033104435, - 102.663059505), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(60.460001335, 62.1982642166667, - 66.5109766833333, 71.5597521, 79.8039668083333, 89.123050385, - 100.753005455), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(49.712654985, 51.4509178666667, - 55.7636303333333, 60.81240575, 69.0566204583333, 78.375704035, - 90.005659105), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(59.139898235, 60.8781611166667, - 65.1908735833333, 70.239649, 78.4838637083333, 87.802947285, - 99.432902355), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(68.3244717525, 70.02935424, - 73.7662491958333, 77.6331969, 84.5239736125, 91.3536477133333, - 95.739326825), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(44.3233075525, 46.02819004, - 49.7650849958333, 53.6320327, 60.5228094125, 67.3524835133333, - 71.738162625), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(60.4876095525, 62.19249204, - 65.9293869958333, 69.7963347, 76.6871114125, 83.5167855133333, - 87.902464625), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(58.8853591525, 60.59024164, - 64.3271365958333, 68.1940843, 75.0848610125, 81.9145351133333, - 86.300214225), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(38.2354472525, 39.94032974, - 43.6772246958333, 47.5441724, 54.4349491125, 61.2646232133333, - 65.650302325), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(60.2681711525, 61.97305364, - 65.7099485958333, 69.5768963, 76.4676730125, 83.2973471133333, - 87.683026225), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr"))), class = c("distribution", "vctrs_vctr", "list" - ))), row.names = c(NA, -30L), class = c("tbl_df", "tbl", "data.frame" - )) + ), class = "Date"), .pred = c(81.46212125, 48.9285099, 59.47903055, + 57.44900655, 62.78917715, 53.8558966, 84.3449863, 51.3826096, + 62.0540565, 67.1289331, 62.6712774, 59.47102, 92.3266162, 51.7816021, + 64.1929086, 67.80972325, 58.13744405, 63.10147305, 84.3449863, + 51.8545645, 66.9333338, 65.8523132, 55.9202576, 64.1234883, 59.50597115, + 48.9275239, 64.0481843, 63.45754255, 43.7883142, 65.37832155), + .pred_distn = structure(list(structure(list(values = c(55.01884375, + 61.9936534, 76.8558811, 85.8705552, 95.7238376875, 107.595355333333, + 124.8294820725), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(22.4852324, + 29.46004205, 44.32226975, 53.33694385, 63.1902263375, 75.0617439833333, + 92.2958707225), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(33.03575305, + 40.0105627, 54.8727904, 63.8874645, 73.7407469875, 85.6122646333333, + 102.8463913725), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(31.00572905, + 37.9805387, 52.8427664, 61.8574405, 71.7107229875, 83.5822406333333, + 100.8163673725), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(36.34589965, + 43.3207093, 58.182937, 67.1976111, 77.0508935875, 88.9224112333333, + 106.1565379725), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(27.4126191, + 34.38742875, 49.24965645, 58.26433055, 68.1176130375, 79.9891306833333, + 97.2232574225), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(59.1059257625, + 65.4267824, 80.893949775, 88.512741775, 98.9851218875, 111.446583986667, + 128.951180125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(26.1435490625, + 32.4644057, 47.931573075, 55.550365075, 66.0227451875, 78.4842072866667, + 95.988803425), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(36.8149959625, + 43.1358526, 58.603019975, 66.221811975, 76.6941920875, 89.1556541866667, + 106.660250325), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(41.8898725625, + 48.2107292, 63.677896575, 71.296688575, 81.7690686875, 94.2305307866667, + 111.735126925), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(37.4322168625, + 43.7530735, 59.220240875, 66.839032875, 77.3114129875, 89.7728750866667, + 107.277471225), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(34.2319594625, + 40.5528161, 56.019983475, 63.638775475, 74.1111555875, 86.5726176866667, + 104.077213825), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(76.597008525, + 83.6285187166667, 89.8466094166667, 96.39787945, 106.5883326375, + 118.488928483333, 139.8972249625), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(36.051994425, 43.0835046166667, 49.3015953166667, + 55.85286535, 66.0433185375, 77.9439143833333, 99.3522108625 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(48.463300925, 55.4948111166667, + 61.7129018166667, 68.26417185, 78.4546250375, 90.3552208833333, + 111.7635173625), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(52.080115575, + 59.1116257666667, 65.3297164666667, 71.8809865, 82.0714396875, + 93.9720355333333, 115.3803320125), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(42.407836375, 49.4393465666667, 55.6574372666667, + 62.2087073, 72.3991604875, 84.2997563333333, 105.7080528125 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(47.371865375, 54.4033755666667, + 60.6214662666667, 67.1727363, 77.3631894875, 89.2637853333333, + 110.6720818125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(75.151683565, + 78.2257355633333, 82.1485257708333, 87.28053515, 96.1483782208333, + 106.438732546667, 113.7276053175), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(42.661261765, 45.7353137633333, 49.6581039708333, + 54.79011335, 63.6579564208333, 73.9483107466667, 81.2371835175 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(57.740031065, 60.8140830633333, + 64.7368732708333, 69.86888265, 78.7367257208333, 89.0270800466667, + 96.3159528175), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(56.659010465, + 59.7330624633333, 63.6558526708333, 68.78786205, 77.6557051208333, + 87.9460594466667, 95.2349322175), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(46.726954865, 49.8010068633333, 53.7237970708333, + 58.85580645, 67.7236495208333, 78.0140038466667, 85.3028766175 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(54.930185565, 58.0042375633333, + 61.9270277708333, 67.05903715, 75.9268802208333, 86.2172345466667, + 93.5061073175), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(50.3425070425, + 53.1286383166667, 57.7775218541667, 61.6092566, 68.5981147666667, + 77.2595451983333, 81.44671049), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(39.7640597925, 42.5501910666667, 47.1990746041667, + 51.03080935, 58.0196675166667, 66.6810979483333, 70.86826324 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(54.8847201925, + 57.6708514666667, 62.3197350041667, 66.15146975, 73.1403279166667, + 81.8017583483333, 85.98892364), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(54.2940784425, 57.0802097166667, 61.7290932541667, + 65.560828, 72.5496861666667, 81.2111165983333, 85.39828189 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(34.6248500925, + 37.4109813666667, 42.0598649041667, 45.89159965, 52.8804578166667, + 61.5418882483333, 65.72905354), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(56.2148574425, 59.0009887166667, 63.6498722541667, + 67.481607, 74.4704651666667, 83.1318955983333, 87.31906089 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr"))), class = c("distribution", "vctrs_vctr", + "list"))), row.names = c(NA, -30L), class = c("tbl_df", "tbl", + "data.frame")) --- @@ -1622,654 +1629,650 @@ 19019, 19019, 19019, 19019, 19019, 19020, 19020, 19020, 19020, 19020, 19020, 19021, 19021, 19021, 19021, 19021, 19021, 19022, 19022, 19022, 19022, 19022, 19022), class = "Date"), .pred = c(37365.5, - 13073.5, 7959, 14445.5, 8805.5, 15877, 37403, 13147, 8193, 14704, - 8780, 15883, 37760.5, 13073.5, 8564.5, 15320, 8615.5, 16014, - 37403, 13147, 8596, 14791, 8497, 16145, 37365.5, 13433.5, 8564.5, - 14747.5, 8432.5, 16289, 37403, 13720, 8596, 14704, 8368, 16145, - 37723, 13433.5, 8816, 14445.5, 8276, 16289, 37328, 13147, 8533, - 14187, 7895, 16433, 37297.5, 13433, 8453.5, 14445.5, 7460, 16535, - 37267, 13719, 8533, 14704, 7282, 17337, 37297.5, 13719.5, 8564.5, - 14445.5, 7297.5, 17515.5, 37056, 12873, 8533, 14187, 6899, 17694, - 37161.5, 12593, 8463, 14183, 6828, 18626.5, 36895, 12313, 8393, - 14179, 6757, 19574, 35681.5, 12312, 8283.5, 14044, 6644, 19309.5, - 35263, 12119, 8150, 13909, 6531, 19574, 31371, 12311, 8068, 13908, - 5863, 19574, 29874, 12119, 8068, 13783, 5817, 19574, 25888, 12119, - 8068, 13783, 5817, 22350, 25816, 12119, 8068, 13783, 5817, 22580, - 24774, 11914, 7686, 13783, 5785, 22350, 24299, 11576, 7629, 13694, - 5662, 19574, 23250, 11543, 7454, 13410, 5632, 19112, 23168, 11423, - 7352, 12951, 5576, 19064, 21159, 11093, 6558, 12892, 5497, 18191, - 20459, 10976, 6384, 12721, 5379, 18191, 19778, 10533, 6343, 12383, - 5379, 18191, 19727, 9816, 6332, 11972, 5111, 17694, 18581, 9594, - 5706, 11492, 5058, 17565, 17672, 9535, 4961, 11209, 4470, 16433, - 17077, 8720, 4957, 11119, 4378, 15274), .pred_distn = structure(list( - structure(list(values = c(15120.675, 17284, 26354.875, 38594, - 47664.7916666667, 52739.7333333333, 54778.35), quantile_levels = c(0.05, + 13147.5, 8167, 14747.5, 8757, 15877, 37403, 13147, 8596, 14791, + 8734, 15883, 37760.5, 13433.5, 8816, 15621, 8445.5, 16014, 37403, + 13720, 9036, 15393, 8394, 16433, 37760.5, 13795.5, 8816, 15092, + 8445.5, 16289, 38118, 13871, 9036, 14791, 8394, 16145, 37723, + 13795.5, 8816, 14747.5, 8289, 16289, 37328, 13720, 8596, 14704, + 7895, 16433, 37297.5, 13719.5, 8453.5, 14747.5, 7460, 16987, + 37328, 13720, 8596, 14791, 7313, 17694, 37297.5, 13719.5, 8790.5, + 14747.5, 7460, 17951, 37267, 13719, 8596, 14704, 7313, 18208, + 37161.5, 13296, 8564.5, 14445.5, 7106, 20697.5, 36895, 12873, + 8393, 14187, 6757, 19574, 36497.5, 12312, 8283.5, 14183, 6644, + 20962, 35263, 12119, 8150, 13909, 6531, 19574, 31371, 12311, + 8068, 13908, 5863, 19574, 29874, 12119, 8068, 13783, 5817, 19574, + 25888, 12119, 8068, 13783, 5817, 22350, 25816, 12119, 8068, 13783, + 5817, 22580, 24774, 11914, 7686, 13783, 5785, 22350, 24299, 11576, + 7629, 13694, 5662, 19574, 23250, 11543, 7454, 13410, 5632, 19112, + 23168, 11423, 7352, 12951, 5576, 19064, 21159, 11093, 6558, 12892, + 5497, 18191, 20459, 10976, 6384, 12721, 5379, 18191, 19778, 10533, + 6343, 12383, 5379, 18191, 19727, 9816, 6332, 11972, 5111, 17694, + 18581, 9594, 5706, 11492, 5058, 17565, 17672, 9535, 4961, 11209, + 4470, 16433, 17077, 8720, 4957, 11119, 4378, 15274), .pred_distn = structure(list( + structure(list(values = c(13505.6, 16257.7333333333, 26529.25, + 38488.5, 47803.5833333333, 52943, 54849.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(1689.5, 2761.25, 10682.2083333333, 14767.5, - 19231.1666666667, 38163.2166666667, 77743.35), quantile_levels = c(0.05, + values = c(1798.7, 2451.95, 10271.125, 14631.5, 19124.5416666667, + 37913.2833333333, 77464.75), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(1939.4, 3574.16666666667, 6179.75, 8875, 11204.25, - 14841.9, 23963.6), quantile_levels = c(0.05, 0.1, 0.25, - 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8982.55, - 10703.05, 12633.1666666667, 15049, 26771.5416666667, 51697.3666666667, - 74481.175), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4155.625, - 5136.7, 7467.04166666667, 9263.25, 10340, 13237.4666666667, - 17797.175), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8823.825, - 9956.8, 13291.5416666667, 15874, 21043.2916666667, 24114.0833333333, - 26033.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(15647, - 17595.3333333333, 28563.3333333333, 38798, 46091.3333333333, - 52616.1666666667, 53727.75), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(1763, 2706.5, 10664.0833333333, 14824, 19157.75, - 39535.1666666667, 77895.5), quantile_levels = c(0.05, + values = c(2147.4, 3752.65, 6336.54166666667, 9070.75, + 11484.9166666667, 14971.85, 24055.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2126.5, 3652.66666666667, 7071.5, 9287, 11473.5, - 15675, 24256), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9204.5, - 10860, 12848.6666666667, 15312, 27405.9166666667, 53366.6666666667, - 75067.75), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4116.25, - 5101, 7299.91666666667, 9146, 10337, 13300.6666666667, 17890.25 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(9624.5, 11331, - 13673.1666666667, 15883, 21719.5, 24178.8333333333, 26047 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(17588.75, 19883.7166666667, - 30488.3333333333, 39255.25, 46582.7916666667, 52631.2166666667, - 53139.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1689.5, - 2504.75, 10865.4583333333, 14616, 19179.1666666667, 40760.1166666666, - 77900.65), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2451.1, - 4721, 7481.25, 9487.75, 11875.9166666667, 16645.6, 24685.9 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(9783.95, 11374.45, - 13401.6666666667, 16386.75, 28429.5, 55393.4666666666, 76011.825 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(3937.875, 4926.3, - 7033.625, 9073.25, 10190, 13224.8666666667, 17844.325), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(9736.85, 12282.2333333333, 13865.6666666667, - 16181.5, 22005.3333333333, 24368.5833333333, 26185.8), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(17217, 19203.7666666667, - 31015.6666666667, 38798, 46015.8333333333, 51909.1333333333, - 52688.7), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1763, - 2450, 11346.5, 14555, 19278.6666666667, 42132.0666666666, - 78052.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(3065.9, - 5031.56666666667, 7500, 9348.5, 11929.6666666667, 17276.2, - 24775.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9218.4, - 10743.9, 12859.6666666667, 15320, 26741.1666666667, 56275.2666666666, - 75810.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(3805.5, - 4797.6, 7270.66666666667, 8863, 10079, 13195.0666666667, - 17844.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10945.4, - 12617.1333333333, 13976.1666666667, 16145, 22266.3333333333, - 24558.3333333333, 26324.6), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(17274.1, 21016.35, 32230.1666666667, 38594, - 45406.5416666667, 51145.7666666667, 52663.8), quantile_levels = c(0.05, + values = c(9205.975, 10792.0333333333, 12938.5, 15369.75, + 26851.9166666667, 51192.7333333333, 74599.425), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2049.5, 2608.25, 11491.625, 14536.25, 19591.1666666667, - 43717.0166666667, 78417.95), quantile_levels = c(0.05, + values = c(4132.625, 5173.11666666667, 7461.91666666667, + 9054.75, 10303.375, 13200.8666666667, 17771.625), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2908.725, 4969.51666666667, 7081, 9305.75, - 11809.75, 17843.8, 24802.7), quantile_levels = c(0.05, + values = c(8787.125, 9949.68333333333, 12840.2916666667, + 15816.5, 21231.125, 25060.15, 28504.575), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(9138.35, 10598.85, 12803.1666666667, 15274.5, - 24619.7916666666, 57642.5666666667, 76095.475), quantile_levels = c(0.05, + values = c(13359, 17130.6666666667, 28892.9166666667, + 38798, 46440.0833333333, 52838, 54064.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3999.425, 5285.61666666667, 7042.41666666667, - 8730.5, 10022, 13219.2666666667, 17898.475), quantile_levels = c(0.05, + values = c(1795, 2370, 10126.25, 14555, 18932.0833333333, + 39212.3333333334, 77512.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(7178.9, 12501.0333333333, 14359.5833333333, - 16456.5, 22540.3333333333, 24761.0833333333, 26476.4), + values = c(2529.5, 4030, 7336.5, 9651, 11921.1666666667, + 15999.5, 24553), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9224.25, + 10790.3333333333, 12943, 15436.5, 27261.1666666667, 52706.3333333334, + 74960.25), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4092.25, + 5132.16666666667, 7303.66666666667, 8989.5, 10295.75, 13271.6666666667, + 17869.75), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9603.5, + 11103.6666666667, 13356.5, 15877, 21436.9166666667, 25184.5, + 28772.25), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(16185.7, + 19338.2, 30417.7916666667, 39255.25, 46966.4166666667, 52746.9333333333, + 54427.7), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2078.3, + 2575.05, 10845.875, 14696, 19267.7916666667, 40798.3833333333, + 77847.25), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2702.6, + 4977.35, 7662.25, 9719.75, 12149.25, 16818.15, 24841.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(18249.15, 21827, - 33813, 38465, 45756.9166666667, 51330.4666666667, 52713.9 + "vctrs_vctr")), structure(list(values = c(10029.025, 11575.1333333333, + 13744, 16202.25, 28511.875, 55006.4333333333, 76107.575), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(3786.375, 4825.71666666667, + 6922.625, 8743.25, 10023.1666666667, 13076.9666666667, 17702.375 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(2336, 4320.63333333333, - 11671, 15128, 19903.6666666667, 45301.9666666667, 78783.1 + "vctrs_vctr")), structure(list(values = c(9716.8, 12099.6166666667, + 13831.75, 16236, 21678.0833333333, 25433.85, 29164.925), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(15758.4, 18701.4, + 30977.3333333333, 38798, 46155.3333333333, 52291.8, 54173.4 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(2814.55, 4970.46666666667, - 6961, 9348.5, 11876.5, 18474.4, 24892.6), quantile_levels = c(0.05, + "vctrs_vctr")), structure(list(values = c(2361.6, 2780.1, + 11444.8333333333, 14837, 19625.6666666667, 42384.4333333333, + 78182), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(3490.5, 5374.46666666667, + 7847, 10091, 12379, 17636.8, 25130.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(9058.3, 10453.8, 12848.6666666667, 15229, - 20189.75, 59009.8666666667, 76380.05), quantile_levels = c(0.05, + values = c(9775.8, 11301.9333333333, 13507, 15910, 27131.6666666667, + 56248.5333333333, 76196.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3882.15, 5102.46666666667, 7407.91666666667, - 8598, 9965, 13243.4666666667, 17952.55), quantile_levels = c(0.05, + values = c(3717.5, 4756.26666666667, 7224.66666666667, + 8649.5, 9988.66666666667, 13119.2666666667, 17772), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(5065.8, 10654.6, 14088.3333333333, 16145, - 22526.3333333333, 24675.8333333333, 26340.2), quantile_levels = c(0.05, + values = c(11078.7, 12872.3333333333, 14339.6666666667, + 16883, 22316.3333333333, 25971.2, 29845.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(18378.125, 23946.75, 34085.9166666667, 38440, - 46298.0833333333, 51797.6666666667, 53046.5), quantile_levels = c(0.05, + values = c(16326.8, 20830.8333333333, 32634.75, 38883.5, + 46655.2083333333, 52755.95, 54634.1), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2049.5, 3323.08333333333, 11245.5416666667, - 14536.25, 19578.1666666667, 46313.9166666667, 78575.25 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(2908.875, 5159.91666666667, - 7635.5, 9557.25, 12127.4166666667, 19293.5, 25171), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(2433.9, 2774.15, 11421.2083333333, 15058, + 19772.5416666667, 43759.4833333333, 78305.75), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(8763.25, 10093.75, 12466.6666666667, 14820.75, - 19597.125, 60162.1666666667, 76449.625), quantile_levels = c(0.05, + values = c(3146.75, 5152.86666666667, 7268.75, 9719.75, + 12133.9166666667, 18015.45, 24978.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3737.375, 4868.16666666667, 7476.95833333333, - 8504, 9882.25, 13240.1666666667, 17979.125), quantile_levels = c(0.05, + values = c(9449.575, 10955.7333333333, 13283, 15523.25, + 24825.1666666666, 57417.6333333333, 76213.225), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(5186, 10656.6666666667, 14614.0833333333, - 16456.5, 22796.4166666667, 24878.5833333333, 26194.25 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(17792.1, 23584.4, - 34696.3333333333, 37700, 45940.8333333333, 51549.8666666667, - 52664.1), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + values = c(4012.9, 5440.66666666667, 7644.75, 8743.25, + 10057.1666666667, 13264.5666666667, 17944.625), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(7168.225, 12262.5166666667, 14176.6666666667, + 16511, 22391.5833333333, 25945.55, 29963.275), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(17412.3, 22308.8, 34428, 38969, 47155.0833333333, + 53220.1, 55094.8), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2506.2, + 4444.2, 11594.6666666667, 15279, 19919.4166666667, 45134.5333333333, + 78429.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(1763, - 2325.53333333333, 10927.6666666667, 14444, 18899, 47084.8333333333, - 78367.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(3243, + 5371.26666666667, 7776.5, 10091, 12361.1666666667, 18834.1, + 25267.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2500.2, - 4846.36666666667, 7201, 9054, 11597, 19609.6, 24946.4), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9123.35, + 10609.5333333333, 12954.5, 15136.5, 20226.4166666667, 58586.7333333334, + 76229.55), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(3906.7, + 5242.66666666667, 7866.58333333333, 8649.5, 10022.6666666667, + 13306.8666666667, 18014.25), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(8468.2, 9733.7, 12490.3333333333, 14412.5, - 18159.1666666667, 61314.4666666666, 76519.2), quantile_levels = c(0.05, + values = c(5065.8, 10541.3, 14013.6666666667, 16139, + 21698.9166666667, 24836.8, 30080.95), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3303.6, 4344.86666666667, 6860.33333333333, - 8121, 9494, 12947.8666666667, 17716.7), quantile_levels = c(0.05, + values = c(16960.25, 23946.75, 34087.8333333333, 38334.5, + 46928.9166666667, 52931.75, 54803), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(5306.2, 10536.8666666667, 14875.5, 16768, - 22554.3333333333, 24503.8, 26405.6), quantile_levels = c(0.05, + values = c(2427.5, 3658.75, 11472.7916666667, 15058, + 19629.7916666667, 46358.5833333334, 78402.25), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(21179.575, 27946.8, 35521.875, 37551.5, 45948.0833333333, - 51644.65, 52646.2), quantile_levels = c(0.05, 0.1, 0.25, - 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2049, - 2134.55, 11182.2916666667, 14785.5, 18669.375, 32430.8333333333, - 74394.4249999998), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2295.025, - 4736, 6970, 8946.5, 10869.5833333333, 20062.9333333333, 24925.3 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(8690.15, 9904.06666666667, - 12897.4583333333, 14820.75, 17735.6666666667, 62814, 77105.775 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(2815.825, 3811.6, - 6189.70833333333, 7545.25, 8971.58333333333, 12665.75, 17400.275 + values = c(2899.25, 5149.66666666667, 7495.25, 9506.5, + 12163.6666666667, 19212.75, 25116), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(9054.625, 10520.8333333333, 12870.5, 15092.25, + 19622.2916666667, 60013.3333333334, 76503.375), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3747, 4991.16666666667, 7655.29166666667, + 8529.75, 9937.54166666667, 13295.6666666667, 18030.375 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(5186, 10631.25, + 14214.6666666667, 16511, 21953.0833333333, 25051.5, 30486.625 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(5384.4, 10307.2, - 14993.3333333333, 17079.5, 22786.3333333333, 24661.5, 26574.95 + "vctrs_vctr")), structure(list(values = c(16277.2, 23612.3, + 34219.6666666667, 37700, 46755.6666666667, 52643.4, 54511.2 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(23686.1, 29890.3333333333, - 36037.5833333333, 37639, 45594.5, 51695.6, 52628.3), quantile_levels = c(0.05, + "vctrs_vctr")), structure(list(values = c(2348.8, 2873.3, + 11338.1666666667, 15017, 19428.8333333333, 47339.3666666666, + 78375), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(2555.5, 4928.06666666667, + 7162, 9117, 11738, 19591.4, 24964.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2335, 8574.13333333333, 11670, 15016, 19161.25, - 34376.8333333333, 76204.95), quantile_levels = c(0.05, + values = c(8985.9, 10432.1333333333, 12980, 15048, 18340.1666666667, + 61439.9333333333, 76777.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(4542.5, 5090.76666666667, 7411.5, 9054, 10206.5, - 20542.7333333333, 25063.2), quantile_levels = c(0.05, + values = c(3298.3, 4450.66666666667, 7011.66666666667, + 8050, 9489.66666666667, 12995.4666666667, 17757.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(9631.3, 11063.1, 13253.25, 15233, 18060.6666666667, - 63974, 77692.35), quantile_levels = c(0.05, 0.1, 0.25, + values = c(5306.2, 10508.4, 14723, 16883, 22316.3333333333, + 25275, 30892.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2585.05, - 3623.4, 5776.08333333333, 7437, 8829.83333333333, 12769, - 17340.85), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(21211.45, + 28351.35, 35104.7916666667, 37619.5, 46709.625, 52688.85, + 54583.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(6162.6, - 10641.8, 15740.8333333333, 18091, 23718.3333333333, 25543, - 27444.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(30252.8, - 32915.3666666667, 36254.9166666667, 38394, 45981.375, 51807.55, - 52671.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9537.9, - 9937.15, 12300.375, 15072, 19342.125, 36037.3333333332, 77729.9749999999 + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2345.1, + 2399.5, 11278.5416666667, 14926.5, 19001.6666666667, 32358.8166666666, + 74049.6499999998), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2289.25, + 4771.45, 6906.25, 8946.5, 10652.625, 19977.2166666667, 24890.7 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(4872.775, 5220.11666666667, - 7384, 9190, 10347.0833333333, 20974.5333333333, 25153.1), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(9342.15, 10703.05, - 12914.2083333333, 14972.5, 17602.6666666667, 51697.3666666666, - 71077.75), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2547.775, - 3628.7, 6498.45833333333, 7488, 8876.25, 13065.75, 17474.925 + "vctrs_vctr")), structure(list(values = c(9004.175, 10411.75, + 12967.25, 15034.25, 17727.1666666667, 62772.8333333333, 77138.025 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(6317.3, 9938.13333333333, - 15833.75, 18726.25, 24022.9166666667, 25801, 27690.15), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_vctr")), structure(list(values = c(2808.6, 3912.01666666667, + 6327.04166666667, 7521.5, 8971.58333333333, 12715.05, 17443.625 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(5836.4, 10729.7166666667, + 15191.2916666667, 18142.75, 23089.5833333333, 25927.9166666667, + 31707.975), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(23944.6, + 31138.5333333333, 36280.1666666667, 38179, 47104.25, 52733.9, + 54717.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(3052.35, + 9589.2, 11699.75, 15017, 19227.6666666667, 34023.7666666667, + 75556.1), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4574.65, + 4940.86666666667, 7336.5, 9224.5, 11000.25, 20507.3666666667, + 25101.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9577.75, + 10880.7333333333, 13239.8333333333, 15308, 17811.6666666667, + 63744.3333333333, 77498.85), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(29958, 32458.6666666667, 35934.8333333333, - 37428, 43582.8333333333, 50394.6666666667, 52442.5), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(8688, 9047, 11108.5, - 13761, 17358, 36850.8333333333, 78407.9999999998), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(2606.9, 3747.06666666667, 6793.75, 7468, 8860.83333333333, + 12844.2, 17417.75), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(6519.6, + 10972.3666666667, 15734.9166666667, 19251.5, 24015.8333333333, + 26772.6666666667, 32676.65), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(4826, 5325.16666666667, 7201, 9054, 10196, - 16015, 24012), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9053, - 10343, 12969.5, 14712, 16784.6666666667, 52849.6666666666, - 71269.9999999999), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2096.5, - 3220, 5888.33333333333, 7054, 8374.33333333333, 12948.5, - 17195), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(5839, 6789.33333333333, - 15657.6666666667, 18448, 24319.6666666667, 26059, 27936), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(30607.125, 33678.5333333333, - 36115.4166666667, 37878.5, 43922.9583333333, 50647.3666666667, - 52658.475), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8024.5, - 9556.51666666667, 11098.125, 13435.75, 16089.7916666667, - 38230.8333333333, 80193.9249999997), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(30143.55, 32933, 36254.9166666667, 38288.5, + 45981.375, 51866.35, 54783.025), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(5046.225, 5518.03333333333, 7354.25, 9088.5, - 10131.25, 16180.0166666666, 24000.4), quantile_levels = c(0.05, + values = c(9504.175, 10087.8, 12112.75, 14926.5, 18563.375, + 35687.7166666666, 77061.5499999999), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(9594.8, 11154.35, 12957.0833333333, 14552.5, - 16489.0833333333, 38163.1333333332, 71594.075), quantile_levels = c(0.05, + values = c(5122.3, 5440.33333333333, 7636.75, 9481, 11397.25, + 21089.5166666666, 25364.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2009.6, 4206.96666666667, 6289.79166666667, - 6913.25, 8092.08333333333, 12020.8833333333, 17221.775 + values = c(9483.625, 10792.0333333333, 13636.5833333333, + 15178.75, 17645.1666666667, 51192.7333333332, 71279.5 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(6711.15, 7674.23333333333, - 17084.8333333333, 20974, 25858.2916666667, 27071, 29131.7 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(29818.25, 33388.7333333333, - 35722.6666666667, 37267, 43891.0833333333, 50528.0666666667, - 52502.45), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(7293, - 9881.46666666667, 10905.25, 13110.5, 14594.8333333333, 25262.2666666667, - 81979.8500000001), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(5252.95, - 5738.8, 7321.91666666667, 8914, 10045.1666666667, 12559.0666666667, - 23988.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10571.95, - 11564, 12882.8333333333, 14393, 16413.5, 19531.1, 71918.15 + "vctrs_vctr")), structure(list(values = c(2699.2, 3876.11666666667, + 7081.375, 7650.5, 9037.66666666667, 13267.35, 17685.875), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(6752.8, 10373.6333333333, + 16482.0416666667, 19689.25, 24420.75, 27167.4166666667, 33195.325 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(2996.25, 4994.6, - 6476.5, 6912, 7750.16666666667, 9530.6, 17248.55), quantile_levels = c(0.05, + "vctrs_vctr")), structure(list(values = c(30054, 32846.3333333333, + 36222.6666666667, 38118, 44345.5, 51942.5, 54863), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(7598.3, 8574.13333333334, 17985.25, 22350, - 26930.4166666667, 28098, 30342.4), quantile_levels = c(0.05, + values = c(9602, 10479.6666666667, 11966, 14836, 18000.6666666667, + 37351.6666666666, 78566.9999999998), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(28082.375, 32151.9333333333, 34478.7916666667, - 36398.5, 41973.7083333333, 48010.3, 50161.475), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(4943, 5436, 7407, 9224.5, 10590, 15999.5, + 23867), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10402, + 11313.3333333333, 13850.6666666667, 15049.5, 17181.3333333333, + 52619.3333333333, 71699.9999999999), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(6840.5, 9856.36666666667, 10891.5, 13154.75, - 14498.5833333333, 18771.2666666667, 44017.8499999999), + values = c(2497.5, 4747.66666666667, 6887.5, 7468, 8788.33333333333, + 13396.5, 17660), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(6353, + 7303.33333333333, 16575.6666666667, 20127, 24683, 27562.1666666667, + 33714), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(30609, 33678.5333333333, + 36115.4166666667, 38152.5, 44796.5, 51943.65, 54882.775), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(5128.925, 5594.2, - 7200.25, 8776.5, 9917.58333333333, 11511.8666666667, 14721.475 + "vctrs_vctr")), structure(list(values = c(8727.5, 10506.25, + 11801.125, 14298.5, 17316.75, 38593.1166666666, 80240.5749999997 ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(11253.775, 11834.0666666667, - 12958.5833333333, 14413.5, 16319.4166666667, 18530.2166666667, - 28316.6749999999), quantile_levels = c(0.05, 0.1, 0.25, 0.5, - 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(2825.375, - 4865.4, 6324.54166666667, 6729.25, 7712.58333333333, 8872.43333333333, - 11120.125), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + "vctrs_vctr")), structure(list(values = c(5286.75, 5818.43333333333, + 7427.5, 9255, 10477.2083333333, 16246.2, 23904.1), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(10572.9, 11566.1333333333, 13513.9166666667, + 14732.25, 16706.1666666667, 38273.0999999999, 71758.825 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(3500.325, 5164.43333333333, + 6782.58333333333, 7167.5, 8370.08333333333, 12298.8833333333, + 17550.65), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(7273.45, - 8262.03333333333, 17576.0416666667, 21657, 26292.0416666667, - 27403.6333333333, 29196.15), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8782.15, + 9745.23333333333, 18901.7916666667, 23672.5, 27843.3333333333, + 30189.4166666667, 38204.6499999997), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(31164.6, 32212.2, 34218.6666666667, 36394, - 41789.8333333333, 47733.4, 49796.3), quantile_levels = c(0.05, + values = c(29822, 33388.7333333333, 35722.6666666667, + 37746, 45086.5, 51783.8, 54741.55), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(6196, 9639.26666666667, 10661, 13007, 14063.6666666667, - 17858.4, 21143.1), quantile_levels = c(0.05, 0.1, 0.25, + values = c(7853, 10025.5, 11340, 13761, 16558.5833333333, + 25362.8666666667, 81914.1500000001), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(5095.5, 5582.53333333333, 7253, 8914, 10045.1666666667, + 12628.6, 23801.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4980.9, - 5425.6, 7054, 8615, 9759, 10855.6, 11832.9), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10957.1, + 11891.6666666667, 13177.1666666667, 14415, 16394.8333333333, + 19398.1666666667, 71817.65), quantile_levels = c(0.05, 0.1, + 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(11076.7, 11603.8666666667, 13055.6666666667, - 14434, 16025, 17239.0666666667, 19112.6), quantile_levels = c(0.05, + values = c(3087.65, 4791.53333333333, 6409.83333333333, + 6725, 7740.16666666667, 9516.13333333334, 17299.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(2654.5, 4736.2, 6102.16666666667, 6546.5, - 7697.33333333333, 8805.13333333333, 9804.8), quantile_levels = c(0.05, + values = c(7598.3, 8574.13333333334, 17622.3333333333, + 22350, 26059.5, 28098, 39082.3000000001), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(7477.6, 8478.93333333333, 17537.6666666667, - 22205, 26681.1666666667, 27669.7333333333, 29791.2), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(27272.6, 28320.2, - 30326.6666666667, 32502, 36595, 42426.2, 45904.3), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(9452.4, 10020.5333333333, 10904, 13608, 14529.3333333333, - 18556.1333333333, 21335.1), quantile_levels = c(0.05, + values = c(32519.95, 33308.7333333333, 35436.1666666667, + 37488.5, 43019.5, 50277.7666666667, 52591.25), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(4898.9, 5343.6, 6972, 8533, 9597, 10012.9333333333, - 11750.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(11075.7, - 11602.8666666667, 13054.6666666667, 14433, 15828.6666666667, - 17238.0666666667, 19111.6), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(6840.5, 9406.75, 10705.25, 13314.5, 14638.9583333333, + 18303.3166666667, 43700.7499999999), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(1986.5, 4068.2, 5444.16666666667, 6018, 7084.66666666667, - 8137.13333333333, 9136.8), quantile_levels = c(0.05, + values = c(4966.25, 5408.63333333333, 7129.75, 8776.5, + 9930.33333333333, 11747.7666666667, 14690.275), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(7477.6, 8478.93333333333, 17537.6666666667, - 22350, 26681.1666666667, 27669.7333333333, 29791.2), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + values = c(10918.65, 11891.1666666667, 13407.9166666667, + 14469.75, 16427.6666666667, 18348.5166666667, 28410.3749999999 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(25775.6, 26823.2, - 28829.6666666667, 30936, 33217, 40929.2, 44407.3), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(9260.4, 9828.53333333333, 10712, 13007, 14063.6666666667, - 17858.4, 18492), quantile_levels = c(0.05, 0.1, 0.25, - 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4898.9, - 5343.6, 6869, 8533, 9597, 10012.9333333333, 11750.9), quantile_levels = c(0.05, + "vctrs_vctr")), structure(list(values = c(2910.975, 4654.63333333333, + 6265.375, 6571.5, 7712.58333333333, 8852.8, 11127.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(10950.7, 11477.8666666667, 12929.6666666667, - 13997, 15703.6666666667, 17113.0666666667, 18986.6), + values = c(8925.95, 9914.53333333333, 18804.5833333333, + 23309.5, 27544.8333333333, 29565.5, 42471.4499999999), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(1940.5, 4022.2, - 5559, 5972, 7038.66666666667, 8091.13333333333, 9090.8), + "vctrs_vctr")), structure(list(values = c(31164.6, 32021.5333333333, + 34218.6666666667, 36394, 41517.8333333333, 47717.1333333333, + 49796.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(6196, + 9156, 10366, 13007, 13878.6666666667, 17648.3, 20612.7), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(7477.6, 9930.13333333334, - 17537.6666666667, 22350, 26681.1666666667, 27669.7333333333, - 29791.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(22459.4, - 23770.6666666667, 24843.6666666667, 26950, 29231, 36943.2, - 40421.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(9153.2, - 9828.53333333333, 10712, 13007, 14063.6666666667, 17858.4, - 18492), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(4898.9, 5776.73333333333, - 6869, 8533, 9597, 10012.9333333333, 11750.9), quantile_levels = c(0.05, + "vctrs_vctr")), structure(list(values = c(4813, 5210.73333333333, + 6961, 8615, 9759, 10560.0666666667, 11782.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(10950.7, 12188, 12929.6666666667, 13997, 15703.6666666667, - 17113.0666666667, 18986.6), quantile_levels = c(0.05, + values = c(10610.2, 11515.6666666667, 13055.6666666667, + 14137, 16014.3333333333, 16913.2666666667, 18871), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3386.1, 4144.46666666667, 5559, 5972, 7038.66666666667, - 8091.13333333333, 9090.8), quantile_levels = c(0.05, + values = c(2734.3, 4517.73333333333, 6168.83333333333, + 6499, 7697.33333333333, 8782.4, 9804.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(10253.6, 12706.1333333333, 20313.6666666667, - 25818, 29848, 31033, 38341.6), quantile_levels = c(0.05, + values = c(7477.6, 8478.93333333333, 17148.3333333333, + 22205, 26049, 27669.7333333333, 29791.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(22387.4, 23437.6666666667, 24717.6666666667, - 26878, 29159, 36871.2, 40349.3), quantile_levels = c(0.05, + values = c(27272.6, 28129.5333333333, 30326.6666666667, + 32502, 36595, 42381.4666666667, 45904.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(9153.2, 9828.53333333333, 10785.5, 13416, - 14261, 17858.4, 18492), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(8994, 9834.56666666667, 10853, 13428, 14255.6666666667, + 18330.8666666667, 20967.1), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(5472.2, 6260.8, 6972, 8533, 9597, 10012.9333333333, - 11750.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(11600.6, - 12188, 12929.6666666667, 13997, 15703.6666666667, 17113.0666666667, - 18986.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + values = c(4731, 5128.73333333333, 6879, 8533, 9524.33333333333, + 10012.9333333333, 11700.5), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(10609.2, 11514.6666666667, 13054.6666666667, + 14136, 15769, 16912.2666666667, 18870), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(2066.3, 3849.73333333333, 5500.83333333333, + 6018, 7084.66666666667, 8114.4, 9136.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(7477.6, 8478.93333333333, 17148.3333333333, + 22350, 26049, 27669.7333333333, 29791.2), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(25775.6, 26632.5333333333, 28829.6666666667, + 30725, 33217, 40884.4666666667, 44407.3), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(8802, 9642.56666666667, 10661, 13007, 13878.6666666667, + 17648.3, 18255.6), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4731, + 5128.73333333333, 6861, 8533, 9524.33333333333, 10012.9333333333, + 11700.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4108.6, - 4173.2, 5559, 5972, 7038.66666666667, 8091.13333333333, 9090.8 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(10483.6, 12936.1333333333, - 20543.6666666667, 26418, 30210.6666666667, 31670.8, 38571.6 - ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 - )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(21345.4, 22418.3333333333, - 23729.6666666667, 25836, 28117, 35829.2, 39307.3), quantile_levels = c(0.05, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10484.2, + 11389.6666666667, 12929.6666666667, 13997, 15644, 16787.2666666667, + 18745), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(2020.3, 3803.73333333333, + 5559, 5972, 7038.66666666667, 8068.4, 9090.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(8948.2, 9623.53333333333, 10580.5, 12802, - 14056, 17653.4, 18287), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(7477.6, 9930.13333333334, 17199.3333333333, + 22350, 26049, 27669.7333333333, 29791.2), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(5090.2, 5878.8, 6590, 8120, 9142.33333333333, - 9630.93333333333, 11368.9), quantile_levels = c(0.05, + values = c(22459.4, 23246.3333333333, 24843.6666666667, + 26739, 29231, 36898.4666666667, 40421.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(11098, 11842.3333333333, 12929.6666666667, - 13997, 15703.6666666667, 17113.0666666667, 18986.6), - quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, - 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(4076.6, 4141.2, - 5500.33333333333, 5800.5, 7006.66666666667, 8059.13333333333, - 9058.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10253.6, - 12706.1333333333, 20313.6666666667, 26030, 29848, 31033, - 33266.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(20870.4, - 21943.3333333333, 23254.6666666667, 25182, 27642, 35354.2, - 38832.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + values = c(9153.2, 9642.56666666667, 10661, 13007, 13878.6666666667, + 17648.3, 18255.6), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4848.6, + 5776.73333333333, 6861, 8533, 9524.33333333333, 10012.9333333333, + 11700.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8610.2, - 9285.53333333333, 10242.5, 11576, 13503.6666666667, 17315.4, - 17949), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10881.8, + 12145.2, 12929.6666666667, 13997, 15644, 16787.2666666667, + 18745), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(5033.2, 5821.8, - 6976.66666666667, 8094, 9179.33333333333, 9573.93333333333, - 11311.9), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(11009, - 11228.6666666667, 12538.3333333333, 13863, 15614.6666666667, - 17024.0666666667, 18897.6), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_vctr")), structure(list(values = c(3192.3, 4022.2, + 5559, 5972, 7038.66666666667, 8068.4, 9090.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3953.6, 4018.2, 5284, 5630, 6725.66666666667, - 7936.13333333333, 8935.8), quantile_levels = c(0.05, + values = c(10253.6, 12706.1333333333, 19975.3333333333, + 25706, 29214.3333333333, 31033, 38341.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(7477.6, 9930.13333333334, 17537.6666666667, - 23042, 26681.1666666667, 28257, 30490.4), quantile_levels = c(0.05, + values = c(22387.4, 23065, 24717.6666666667, 26667, 29159, + 36826.4666666667, 40349.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(19821.4, 20894.3333333333, 22205.6666666667, - 23879, 25537.3333333333, 32504.6, 35472.9), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(9153.2, 9828.53333333333, 10712, 13236, 14046.6666666667, + 17648.3, 18255.6), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(5472.2, + 6260.8, 6934, 8533, 9524.33333333333, 10012.9333333333, 11700.5 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(11600.6, 12145.2, + 12929.6666666667, 13997, 15644, 16787.2666666667, 18745), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(3931.2, 4163.66666666667, + 5559, 5972, 7038.66666666667, 8068.4, 9090.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(8577.2, 9252.53333333333, 10209.5, 11543, - 13470.6666666667, 16077.6666666667, 17680.4), quantile_levels = c(0.05, + values = c(10483.6, 12936.1333333333, 20205.3333333333, + 26048, 30210.6666666667, 31670.8, 38571.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(4858.2, 5646.8, 6801.66666666667, 7919, 9004.33333333333, - 9398.93333333333, 11136.9), quantile_levels = c(0.05, + values = c(21345.4, 22418.3333333333, 23729.6666666667, + 25625, 28117, 35784.4666666667, 39307.3), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(10725, 10944.6666666667, 12245.6666666667, - 13553, 15212.8333333333, 16319.9333333333, 18613.6), + values = c(8948.2, 9623.53333333333, 10507, 12802, 13841.6666666667, + 17443.3, 18050.6), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(5090.2, + 5878.8, 6552, 8120, 9142.33333333333, 9630.93333333333, 11318.5 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(11098, 11842.3333333333, + 12929.6666666667, 13997, 15644, 16787.2666666667, 18745), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(3923.6, 3988.2, - 5254, 5600, 6695.66666666667, 7906.13333333333, 8905.8), + "vctrs_vctr")), structure(list(values = c(3899.2, 4131.66666666667, + 5500.33333333333, 5753, 7006.66666666667, 8036.4, 9058.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(7015.6, 9468.13333333334, - 17075.6666666667, 21888, 25737.6666666667, 27790.7333333333, - 30028.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(19739.4, - 20812.3333333333, 22123.6666666667, 23797, 25455.3333333333, - 30070.2333333333, 33469.6), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", - "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(8457.2, 9132.53333333333, 10089.5, 11423, - 13183.3333333333, 14916.2, 16487.6), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_vctr")), structure(list(values = c(10253.6, 12706.1333333333, + 19975.3333333333, 25818, 29214.3333333333, 31033, 33266.4 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(20870.4, 21943.3333333333, + 23254.6666666667, 25150, 27642, 35309.4666666667, 38832.3 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(8610.2, 9285.53333333333, + 10169, 11576, 13335.6666666667, 17105.3, 17712.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(4756.2, 5544.8, 6699.66666666667, 7817, 8785, - 9005.33333333333, 9670.6), quantile_levels = c(0.05, + values = c(5033.2, 5821.8, 6850, 8094, 9179.33333333333, + 9573.93333333333, 11261.5), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(10266, 10485.6666666667, 11786.6666666667, - 13094, 14753.8333333333, 15439.2666666667, 16571), quantile_levels = c(0.05, + values = c(11009, 11228.6666666667, 12538.3333333333, + 13863, 15555, 16698.2666666667, 18656), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3867.6, 3932.2, 5198, 5544, 6440.66666666667, - 7378.46666666667, 8283.4), quantile_levels = c(0.05, - 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(3776.2, 4008.66666666667, 5284, 5549, 6725.66666666667, + 7913.4, 8935.8), quantile_levels = c(0.05, 0.1, 0.25, + 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(7477.6, + 9930.13333333334, 17199.3333333333, 22930, 26049, 28257, + 30490.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(19821.4, + 20894.3333333333, 22205.6666666667, 23879, 25537.3333333333, + 32287, 35424.1), quantile_levels = c(0.05, 0.1, 0.25, 0.5, + 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8577.2, + 9252.53333333333, 10136, 11543, 13302.6666666667, 16077.6666666667, + 17451.2), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4858.2, + 5646.8, 6675, 7919, 9004.33333333333, 9398.93333333333, 11086.5 + ), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95 + )), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(10725, 10944.6666666667, + 12245.6666666667, 13414, 15162.3333333333, 16256.1333333333, + 18372), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(3746.2, 3978.66666666667, + 5254, 5519, 6695.66666666667, 7883.4, 8905.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(6967.6, 9420.13333333334, 17027.6666666667, - 21695, 25185.3333333333, 27742.7333333333, 29980.4), + values = c(7015.6, 9468.13333333334, 16737.3333333333, + 21888, 24995.3333333333, 27790.7333333333, 30028.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", - "vctrs_vctr")), structure(list(values = c(17730.4, 18803.3333333333, - 20114.6666666667, 21531, 23113, 26977, 28884.8), quantile_levels = c(0.05, + "vctrs_vctr")), structure(list(values = c(19739.4, 20812.3333333333, + 22123.6666666667, 23797, 25455.3333333333, 29471.8333333333, + 33457.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(8457.2, + 9132.53333333333, 10016, 11423, 13064.6666666667, 14882.3333333333, + 16487.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + 0.9, 0.95)), class = c("dist_quantiles", "dist_default", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(4756.2, + 5544.8, 6573, 7817, 8785, 9005.33333333333, 9658), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(8127.2, 8802.53333333333, 9759.5, 11042, 12820.6666666667, - 14586.2, 16157.6), quantile_levels = c(0.05, 0.1, 0.25, - 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(3962.2, - 4750.8, 5905.66666666667, 6992, 7636.66666666667, 8200.53333333333, - 8292.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, + values = c(10266, 10485.6666666667, 11786.6666666667, + 12955, 14703.3333333333, 15439.2666666667, 16501.4), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(3690.2, 3922.66666666667, + 5198, 5463, 6255.33333333333, 7378.46666666667, 8258.6), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(6967.6, 9420.13333333334, + 16689.3333333333, 21695, 24506.6666666667, 27742.7333333333, + 29980.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10207, - 10426.6666666667, 11727.6666666667, 13035, 14644.3333333333, - 15178.4666666667, 16052), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(17730.4, + 18803.3333333333, 20114.6666666667, 21531, 23113, 26977, + 28232), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(8127.2, 8802.53333333333, + 9686, 11042, 12587, 14552.3333333333, 16157.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3962.2, 4750.8, 5779, 6992, 7636.66666666667, + 8200.53333333333, 8292.8), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3788.6, 3853.2, 5119, 5465, 6173.33333333333, + values = c(10207, 10426.6666666667, 11727.6666666667, + 12896, 14513, 15178.4666666667, 16052), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(3611.2, 3843.66666666667, 5119, 5384, 6039.33333333333, 6873.33333333333, 7838.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(6094.6, 8547.13333333334, 15299, 20127, 23727.6666666667, + values = c(6094.6, 8547.13333333334, 15152, 20127, 23361.1666666667, 26869.7333333333, 29107.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( values = c(17030.4, 18103.3333333333, 19360.6666666667, - 20459, 22413, 26277, 28184.8), quantile_levels = c(0.05, + 20459, 22413, 26277, 27532), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(8010.2, 8685.53333333333, 9642, 10925, 12703.6666666667, - 14469.2, 16040.6), quantile_levels = c(0.05, 0.1, 0.25, - 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(3788.2, - 4576.8, 5346.33333333333, 6818, 7462.66666666667, 8026.53333333333, - 8118.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, - 0.9, 0.95)), class = c("dist_quantiles", "dist_default", - "vctrs_rcrd", "vctrs_vctr")), structure(list(values = c(10036, - 10255.6666666667, 11556.6666666667, 12864, 14080.3333333333, - 15007.4666666667, 15881), quantile_levels = c(0.05, 0.1, - 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + values = c(8010.2, 8685.53333333333, 9518, 10925, 12470, + 14435.3333333333, 16040.6), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3670.6, 3735.2, 4809, 5266, 6055.33333333333, - 6755.33333333333, 7720.8), quantile_levels = c(0.05, + values = c(3788.2, 4576.8, 5325.33333333333, 6818, 7462.66666666667, + 8026.53333333333, 8118.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(6094.6, 8547.13333333334, 15152, 20127, 23727.6666666667, - 26869.7333333333, 29107.4), quantile_levels = c(0.05, + values = c(10036, 10255.6666666667, 11556.6666666667, + 12725, 14080.3333333333, 15007.4666666667, 15881), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(16349.4, 17422.3333333333, 18679.6666666667, - 19778, 21732, 25596, 27503.8), quantile_levels = c(0.05, + values = c(3493.2, 3725.66666666667, 4809, 5266, 5921.33333333333, + 6755.33333333333, 7720.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", + "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( + values = c(6094.6, 8547.13333333334, 14977.6666666667, + 20127, 23361.1666666667, 26869.7333333333, 29107.4), + quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, + 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", + "vctrs_vctr")), structure(list(values = c(16349.4, 17422.3333333333, + 18679.6666666667, 19778, 21732, 25596, 26851), quantile_levels = c(0.05, + 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( values = c(7567.2, 8242.53333333333, 9379.66666666667, - 10482, 12260.6666666667, 14026.2, 15597.6), quantile_levels = c(0.05, + 10482, 12027, 13992.3333333333, 15597.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( values = c(3747.2, 4535.8, 5711.33333333333, 6777, 7421.66666666667, @@ -2277,23 +2280,23 @@ 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( values = c(9698, 9917.66666666667, 11218.6666666667, - 12526, 13742.3333333333, 14669.4666666667, 15543), quantile_levels = c(0.05, + 12387, 13742.3333333333, 14669.4666666667, 15543), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(3670.6, 3908, 5001, 5347, 6224.33333333333, + values = c(3670.6, 3908, 5001, 5347, 6121.66666666667, 6755.33333333333, 7720.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(6094.6, 8547.13333333334, 15152, 20127, 23727.6666666667, + values = c(6094.6, 8547.13333333334, 15152, 20127, 23361.1666666667, 26869.7333333333, 29107.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( values = c(16298.4, 17371.3333333333, 18628.6666666667, - 19727, 21681, 25545, 27452.8), quantile_levels = c(0.05, + 19727, 21681, 25545, 26800), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( values = c(6850.2, 7525.53333333333, 8662.66666666667, - 9765, 11335.6666666667, 13275.3333333333, 14880.6), quantile_levels = c(0.05, + 9765, 11235, 13275.3333333333, 14880.6), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( values = c(3736.2, 4524.8, 5700.33333333333, 6714, 7410.66666666667, @@ -2308,12 +2311,12 @@ 6487.33333333333, 7452.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(5597.6, 8050.13333333334, 14655, 19574, 22723.3333333333, + values = c(5597.6, 8050.13333333334, 14655, 19574, 21943, 26372.7333333333, 28610.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( values = c(15152.4, 16225.3333333333, 17482.6666666667, - 18581, 20535, 24399, 26306.8), quantile_levels = c(0.05, + 18581, 20535, 24399, 25654), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( values = c(6628.2, 7303.53333333333, 8440.66666666667, @@ -2332,7 +2335,7 @@ 6263.53333333333, 7399.8), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( - values = c(5468.6, 7921.13333333334, 14526, 19172, 21793.1666666667, + values = c(5468.6, 7921.13333333334, 14526, 19172, 21297.6666666667, 26243.7333333333, 28481.4), quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95)), class = c("dist_quantiles", "dist_default", "vctrs_rcrd", "vctrs_vctr")), structure(list( diff --git a/tests/testthat/test-climatological_forecaster.R b/tests/testthat/test-climatological_forecaster.R index 16f31140..24f99c26 100644 --- a/tests/testthat/test-climatological_forecaster.R +++ b/tests/testthat/test-climatological_forecaster.R @@ -24,3 +24,29 @@ test_that("climate args list validates properly", { expect_snapshot(error = TRUE, climate_args_list(quantile_by_key = TRUE)) expect_snapshot(error = TRUE, climate_args_list(quantile_by_key = 2:3)) }) + +test_that("climatological_forecaster works as expected", { + single_yr <- seq(as.Date("2020-01-01"), as.Date("2020-12-31"), by = "1 day") + x <- tibble( + time_value = rep(single_yr, times = 2L), + geo_value = rep(c("reg1", "reg2"), each = length(single_yr)), + y = rep(c(1:183, 184:2), times = 2L) + ) %>% + as_epi_df(as_of = max(single_yr)) + clim_forecast <- climatological_forecaster(x, "y", args_list = climate_args_list(time_type = "day")) + preds <- clim_forecast$predictions %>% + mutate( + quant_med = median(.pred_distn) + ) + expect_equal(preds$.pred, preds$quant_med) + + expected_res <- tibble( + geo_value = rep(c("reg1", "reg2"), 5), + forecast_date = as.Date("2020-12-31"), + target_date = c( + rep(as.Date("2020-12-31"), 2), rep(as.Date("2021-01-01"), 2), rep(as.Date("2021-01-02"), 2), rep(as.Date("2021-01-03"), 2), rep(as.Date("2021-01-04"), 2) + ), + .pred = c(rep(3, 8), rep(4, 2)) + ) + expect_equal(preds %>% select(geo_value, forecast_date, target_date, .pred), expected_res) +}) From fda832f77362fc28aaff2601be0c17541a3be571 Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Thu, 27 Feb 2025 17:25:41 -0600 Subject: [PATCH 50/54] feb 29 is day 60, so the boundary is 59-60 --- R/step_climate.R | 4 ++-- tests/testthat/test-step_climate.R | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/step_climate.R b/R/step_climate.R index 5bb2556a..44a9114e 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -358,9 +358,9 @@ roll_modular_multivec <- function(col, .idx, weights, aggr, window_size, modulus if (modulus == 365) { # we need to grab just the window around the leap day on the leap day if (iter == 366) { - entries <- ((60 - window_size):(60 + window_size - 1) %% modulus) + entries <- ((59 - window_size):(59 + window_size - 1) %% modulus) entries <- c(entries, 366) - } else if ((60 %in% entries) || (61 %in% entries)) { + } else if ((59 %in% entries) || (60 %in% entries)) { # if we're on the Feb/March boundary for daily data, we need to add in the # leap day data entries <- c(entries, 366) diff --git a/tests/testthat/test-step_climate.R b/tests/testthat/test-step_climate.R index 3fa0fd47..008df5f2 100644 --- a/tests/testthat/test-step_climate.R +++ b/tests/testthat/test-step_climate.R @@ -138,7 +138,7 @@ test_that("prep/bake steps create the correct training data for daily data", { expected_res <- tibble( .idx = c(1:365, 999), - climate_y = c(3, 3, 3:(60 - 4), 57.5:64.5, 66:181, rep(182, 5), 181:3, 3, 60) + climate_y = c(3, 3, 3:(59 - 4), 56.5:63.5, 65:181, rep(182, 5), 181:3, 3, 59) ) expect_equal(p$steps[[1]]$climate_table, expected_res) From 49882f21bb3bec70981cef1d411612ce0ca9edf1 Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Mon, 3 Mar 2025 12:16:38 -0600 Subject: [PATCH 51/54] Dan's feedback, < a full year, test monthly agg --- NAMESPACE | 4 +++ R/step_climate.R | 53 +++++++++++++++++------------- man/step_adjust_latency.Rd | 4 +-- tests/testthat/test-step_climate.R | 47 ++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 25 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index eb835105..40cc8232 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -279,6 +279,10 @@ importFrom(glue,glue) importFrom(hardhat,extract_recipe) importFrom(hardhat,refresh_blueprint) importFrom(hardhat,run_mold) +importFrom(lubridate,"%m-%") +importFrom(lubridate,leap_year) +importFrom(lubridate,month) +importFrom(lubridate,yday) importFrom(magrittr,"%>%") importFrom(magrittr,extract2) importFrom(recipes,bake) diff --git a/R/step_climate.R b/R/step_climate.R index 44a9114e..eb2e78d1 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -274,12 +274,13 @@ prep.step_climate <- function(x, training, info = NULL, ...) { ahead_period <- switch(x$time_type, epiweek = lubridate::weeks(x$forecast_ahead), week = lubridate::weeks(x$forecast_ahead), - month = lubridate::months(x$forecast_ahead), + month = months(x$forecast_ahead), day = lubridate::days(x$forecast_ahead), ) climate_table <- training %>% mutate( + # subtracts a month w/o rollover (usual behavior on weeks/days) .idx = time_value %m-% ahead_period, .idx = x$time_aggr(.idx), .weights = wts @@ -344,69 +345,75 @@ print.step_climate <- function(x, width = max(20, options()$width - 30), ...) { #' @param window_size the number of .idx entries before and after to include in #' the aggregation #' @param modulus the maximum value of `.idx` +#' @importFrom lubridate %m-% roll_modular_multivec <- function(col, .idx, weights, aggr, window_size, modulus) { tib <- tibble(col = col, weights = weights, .idx = .idx) |> arrange(.idx) |> tidyr::nest(data = c(col, weights), .by = .idx) - out <- double(nrow(tib)) + out <- double(modulus + 1) for (iter in seq_along(out)) { # +1 from 1-indexing - entries <- ((iter - window_size):(iter + window_size) %% modulus) + entries <- (iter - window_size):(iter + window_size) %% modulus entries[entries == 0] <- modulus # note that because we are 1-indexing, we're looking for indices that are 1 # larger than the actual day/week in the year if (modulus == 365) { # we need to grab just the window around the leap day on the leap day if (iter == 366) { - entries <- ((59 - window_size):(59 + window_size - 1) %% modulus) - entries <- c(entries, 366) + # there's an extra data point in front of the leap day + entries <- (59 - window_size):(59 + window_size - 1) %% modulus + entries[entries == 0] <- modulus + # adding in the leap day itself + entries <- c(entries, 999) } else if ((59 %in% entries) || (60 %in% entries)) { # if we're on the Feb/March boundary for daily data, we need to add in the # leap day data - entries <- c(entries, 366) + entries <- c(entries, 999) } } else if (modulus == 52) { # we need to grab just the window around the leap week on the leap week if (iter == 53) { - entries <- ((53 - window_size):(53 + window_size - 1) %% 52) + entries <- (53 - window_size):(53 + window_size - 1) %% 52 entries[entries == 0] <- 52 - entries <- c(entries, 53) + entries <- c(entries, 999) } else if ((52 %in% entries) || (1 %in% entries)) { # if we're on the year boundary for weekly data, we need to add in the # leap week data (which is the extra week at the end) - entries <- c(entries, 53) + entries <- c(entries, 999) } } out[iter] <- with( - purrr::list_rbind(tib$data[entries]), + purrr::list_rbind(tib |> filter(.idx %in% entries) |> pull(data)), aggr(col, weights) ) } - tibble(.idx = unique(tib$.idx), climate_pred = out) + tibble(.idx = unique(tib$.idx), climate_pred = out[seq_len(nrow(tib))]) } #' a function that assigns Feb 29th to -1, and aligns all other dates the same #' number in the year, regardless of whether it's a leap year #' @keywords internal +#' @importFrom lubridate yday month leap_year yday_leap <- function(time_value) { - ifelse( - !lubridate::leap_year(time_value), - lubridate::yday(time_value), - ifelse( - (lubridate::month(time_value) == 2) & lubridate::day(time_value) == 29, - 999, - lubridate::yday(time_value) - (lubridate::month(time_value) > 2) - ) + dplyr::case_when( + !leap_year(time_value) ~ yday(time_value), + leap_day(time_value) ~ 999, + TRUE ~ yday(time_value) - as.numeric(month(time_value) > 2L) ) } -#' epiweek, but it assigns week 53 the value of -1 instead so it mirrors the assignments in yday_leap +leap_day <- function(x) lubridate::month(x) == 2 & lubridate::day(x) == 29 +#' epiweek, but it assigns week 53 the value of 999 instead so it mirrors the assignments in yday_leap #' @keywords internal epiweek_leap <- function(time_value) { - lubridate::epiweek(time_value) %>% ifelse(. == 53, 999, .) + week_values <- lubridate::epiweek(time_value) + week_values[week_values == 53] <- 999 + week_values } -#' isoweek, but it assigns week 53 the value of -1 instead so it mirrors the assignments in yday_leap +#' isoweek, but it assigns week 53 the value of 999 instead so it mirrors the assignments in yday_leap #' @keywords internal isoweek_leap <- function(time_value) { - lubridate::isoweek(time_value) %>% ifelse(. == 53, 999, .) + week_values <- lubridate::isoweek(time_value) + week_values[week_values == 53] <- 999 + week_values } diff --git a/man/step_adjust_latency.Rd b/man/step_adjust_latency.Rd index 75d67447..1fadd3ab 100644 --- a/man/step_adjust_latency.Rd +++ b/man/step_adjust_latency.Rd @@ -267,8 +267,8 @@ while this will not: \if{html}{\out{
}}\preformatted{toy_recipe <- epi_recipe(toy_df) \%>\% step_epi_lag(a, lag=0) \%>\% step_adjust_latency(a, method = "extend_lags") -#> Warning: If `method` is "extend_lags" or "locf", then the previous `step_epi_lag`s won't -#> work with modified data. +#> Warning: If `method` is "extend_lags" or "locf", then the previous `step_epi_lag`s won't work with +#> modified data. }\if{html}{\out{
}} If you create columns that you then apply lags to (such as diff --git a/tests/testthat/test-step_climate.R b/tests/testthat/test-step_climate.R index 008df5f2..3dca9ec6 100644 --- a/tests/testthat/test-step_climate.R +++ b/tests/testthat/test-step_climate.R @@ -97,6 +97,29 @@ test_that("prep/bake steps create the correct training data", { expect_equal(b, expected_bake) }) +test_that("prep/bake steps create the correct training data with an incomplete year", { + single_yr <- seq(as.Date("2021-01-01"), as.Date("2021-10-31"), by = "1 day") + x <- tibble( + time_value = rep(single_yr, times = 2L), + geo_value = rep(c("reg1", "reg2"), each = length(single_yr)), + # shift by 2 days to match the epiweeks of 2021 + y = rep(c(1, 1, rep(c(1:26, 26:2), each = 7), 1, 1, 1, 1, 1, 1)[1:length(single_yr)], times = 2L) + ) %>% + as_epi_df() + # epiweeks 1, 52, and 53 are all 1, note that there are days in wk 52, 2 in wk 53 + r <- epi_recipe(x) %>% step_climate(y, time_type = "epiweek") + p <- prep(r, x) + + expected_res <- tibble(.idx = c(1:44, 999), climate_y = c(2, 3, 3, 4:25, 25, 25, 25:12, 12, 11, 11, 10)) + expect_equal(p$steps[[1]]$climate_table, expected_res) + + b <- bake(p, new_data = NULL) + expected_bake <- x %>% + mutate(.idx = epiweek_leap(time_value)) %>% + left_join(expected_res, by = join_by(.idx)) %>% + select(-.idx) + expect_equal(b, expected_bake) +}) test_that("prep/bake steps create the correct training data for non leapweeks", { single_yr <- seq(as.Date("2023-01-01"), as.Date("2023-12-31"), by = "1 day") @@ -122,6 +145,30 @@ test_that("prep/bake steps create the correct training data for non leapweeks", expect_equal(b, expected_bake) }) +test_that("prep/bake steps create the correct training data months", { + single_yr <- seq(as.Date("2021-01-01"), as.Date("2023-12-31"), by = "1 day") + x <- tibble( + time_value = rep(single_yr, times = 2L), + geo_value = rep(c("reg1", "reg2"), each = length(single_yr)), + ) %>% + # 1 2 3 4 5 6 6 5 4 3 2 1, assigned based on the month + mutate(y = pmin(13 - month(time_value), month(time_value))) %>% + as_epi_df() + + # epiweeks 1, 52, and 53 are all 1, note that there are days in wk 52, 2 in wk 53 + r <- epi_recipe(x) %>% step_climate(y, time_type = "month", window_size = 1) + p <- prep(r, x) + + expected_res <- tibble(.idx = 1:12, climate_y = c(1:6, 6:1)) + expect_equal(p$steps[[1]]$climate_table, expected_res) + + b <- bake(p, new_data = NULL) + expected_bake <- x %>% + mutate(.idx = month(time_value)) %>% + left_join(expected_res, by = join_by(.idx)) %>% + select(-.idx) + expect_equal(b, expected_bake) +}) test_that("prep/bake steps create the correct training data for daily data", { From 6424f392df68cd23ec634727f412e0bbd346eed7 Mon Sep 17 00:00:00 2001 From: David Weber Date: Wed, 5 Mar 2025 12:43:41 -0800 Subject: [PATCH 52/54] pipe R dependency Co-authored-by: Daniel McDonald --- R/step_climate.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/step_climate.R b/R/step_climate.R index eb2e78d1..6feb31a8 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -383,7 +383,7 @@ roll_modular_multivec <- function(col, .idx, weights, aggr, window_size, modulus } } out[iter] <- with( - purrr::list_rbind(tib |> filter(.idx %in% entries) |> pull(data)), + purrr::list_rbind(tib %>% filter(.idx %in% entries) %>% pull(data)), aggr(col, weights) ) } From 7c9d1c6882ba20116afb0ed8ea15c799330df728 Mon Sep 17 00:00:00 2001 From: David Weber Date: Wed, 5 Mar 2025 12:43:54 -0800 Subject: [PATCH 53/54] -1 -> 999 Co-authored-by: Daniel McDonald --- R/step_climate.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/step_climate.R b/R/step_climate.R index 6feb31a8..800de535 100644 --- a/R/step_climate.R +++ b/R/step_climate.R @@ -391,7 +391,7 @@ roll_modular_multivec <- function(col, .idx, weights, aggr, window_size, modulus } -#' a function that assigns Feb 29th to -1, and aligns all other dates the same +#' a function that assigns Feb 29th to 999, and aligns all other dates the same #' number in the year, regardless of whether it's a leap year #' @keywords internal #' @importFrom lubridate yday month leap_year From 03d50b2a5457ea047502d5fc5ca26e2ac9c6ecad Mon Sep 17 00:00:00 2001 From: dsweber2 Date: Tue, 11 Mar 2025 12:53:50 -0500 Subject: [PATCH 54/54] version bump, minor doc update --- DESCRIPTION | 2 +- man/step_adjust_latency.Rd | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1a713fa3..d5603335 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: epipredict Title: Basic epidemiology forecasting methods -Version: 0.1.10 +Version: 0.1.11 Authors@R: c( person("Daniel J.", "McDonald", , "daniel@stat.ubc.ca", role = c("aut", "cre")), person("Ryan", "Tibshirani", , "ryantibs@cmu.edu", role = "aut"), diff --git a/man/step_adjust_latency.Rd b/man/step_adjust_latency.Rd index 1fadd3ab..9e1bafbd 100644 --- a/man/step_adjust_latency.Rd +++ b/man/step_adjust_latency.Rd @@ -143,7 +143,7 @@ toy_recipe \%>\% #> #> # A tibble: 8 x 4 #> geo_value time_value a b -#> * +#> #> 1 ca 2015-01-11 100 5 #> 2 ca 2015-01-12 103 10 #> 3 ca 2015-01-13 103 10 @@ -179,7 +179,7 @@ toy_recipe \%>\% #> #> # A tibble: 21 x 7 #> geo_value time_value a b lag_3_a lag_4_b ahead_1_a -#> * +#> #> 1 ca 2015-01-10 NA NA NA NA 100 #> 2 ca 2015-01-11 100 5 NA NA 103 #> 3 ca 2015-01-12 103 10 NA NA NA @@ -227,7 +227,7 @@ toy_recipe \%>\% #> #> # A tibble: 10 x 6 #> geo_value time_value a b lag_0_a ahead_3_a -#> * +#> #> 1 ca 2015-01-08 NA NA NA 100 #> 2 ca 2015-01-09 NA NA NA 103 #> 3 ca 2015-01-11 100 5 100 NA