diff --git a/R/flatline_forecaster.R b/R/flatline_forecaster.R index e437f50ea..197c8cca5 100644 --- a/R/flatline_forecaster.R +++ b/R/flatline_forecaster.R @@ -94,6 +94,12 @@ flatline_forecaster <- function( #' Constructs a list of arguments for [flatline_forecaster()]. #' #' @inheritParams arx_args_list +#' @param ahead Integer. Unlike [arx_forecaster()], this doesn't have any effect +#' on the predicted values. Predictions are always the most recent observation. +#' However, this _does_ impact the residuals stored in the object. Residuals +#' are calculated based on this number to mimic how badly you would have done. +#' So for example, `ahead = 7` will create residuals by comparing values +#' 7 days apart. #' #' @return A list containing updated parameter choices with class `flatline_alist`. #' @export diff --git a/R/layer_cdc_flatline_quantiles.R b/R/layer_cdc_flatline_quantiles.R index c64b96c2d..3f178f6da 100644 --- a/R/layer_cdc_flatline_quantiles.R +++ b/R/layer_cdc_flatline_quantiles.R @@ -149,7 +149,7 @@ propogate_samples <- function( for (iter in 2:max_ahead) { samp <- shuffle(samp) raw <- raw + samp - if (symmetrize) symmetric <- raw - (median(raw) + p) + if (symmetrize) symmetric <- raw - (median(raw) - p) else symmetric <- raw if (nonneg) symmetric <- pmax(0, symmetric) res[[iter]] <- symmetric @@ -157,7 +157,7 @@ propogate_samples <- function( } res <- res[aheads] list(tibble::tibble( - aheads = aheads, + ahead = aheads, .pred_distn = map_vec( res, ~ dist_quantiles(quantile(.x, quantiles), tau = quantiles) )