Skip to content

Commit bece1fe

Browse files
committed
compute the .pred_distn using residuals. document the default
1 parent cfad1f1 commit bece1fe

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

R/climatological_forecaster.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@
77
#' forecast, essentially predicting "typical January" behavior by relying on a
88
#' long history of such periods rather than heavily using recent data.
99
#'
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 = ...)`.
1219
#'
1320
#' @inheritParams flatline_forecaster
1421
#' @param args_list A list of additional arguments as created by the
@@ -124,6 +131,8 @@ climatological_forecaster <- function(epi_data,
124131
)))
125132
}
126133
climate_quantiles <- epi_data %>%
134+
left_join(climate_center, by = c(".idx", keys)) %>%
135+
mutate(sym_outcome = sym_outcome - .pred) %>%
127136
select(.idx, .weights, all_of(c(outcome, args_list$quantile_by_key))) %>%
128137
dplyr::reframe(
129138
roll_modular_multivec(

man/climatological_forecaster.Rd

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)