|
7 | 7 | #' forecast, essentially predicting "typical January" behavior by relying on a
|
8 | 8 | #' long history of such periods rather than heavily using recent data.
|
9 | 9 | #'
|
10 |
| -#' The forecast is taken as the quantiles of the `outcome` in a small window |
11 |
| -#' around the target period, computed over the entire available history. |
| 10 | +#' The point forecast is either the mean or median of the `outcome` in a small |
| 11 | +#' window around the target period, computed over the entire available history, |
| 12 | +#' separately for each key in the `epi_df` (`geo_value` and any additional keys). |
| 13 | +#' The forecast quantiles are computed from the residuals for this point prediction. |
| 14 | +#' By default, the residuals are ungrouped, meaning every key will have the same |
| 15 | +#' shape distribution (though different centers). Note that if your data is not |
| 16 | +#' or comparable scales across keys, this default is likely inappropriate. In that |
| 17 | +#' case, you can choose by which keys quantiles are computed using |
| 18 | +#' `climate_args_list(quantile_by_key = ...)`. |
12 | 19 | #'
|
13 | 20 | #' @inheritParams flatline_forecaster
|
14 | 21 | #' @param args_list A list of additional arguments as created by the
|
@@ -124,6 +131,8 @@ climatological_forecaster <- function(epi_data,
|
124 | 131 | )))
|
125 | 132 | }
|
126 | 133 | climate_quantiles <- epi_data %>%
|
| 134 | + left_join(climate_center, by = c(".idx", keys)) %>% |
| 135 | + mutate(sym_outcome = sym_outcome - .pred) %>% |
127 | 136 | select(.idx, .weights, all_of(c(outcome, args_list$quantile_by_key))) %>%
|
128 | 137 | dplyr::reframe(
|
129 | 138 | roll_modular_multivec(
|
|
0 commit comments