get_by_location_group_ensemble_fits_and_predictions: Calculate ensemble fits separately by location group

View source: R/qra_fit_convenience.R

get_by_location_group_ensemble_fits_and_predictionsR Documentation

Calculate ensemble fits separately by location group

Description

Calculate ensemble fits separately by location group

Usage

get_by_location_group_ensemble_fits_and_predictions(
  forecasts,
  observed_by_location_target_end_date,
  forecast_week_end_date,
  window_size,
  intercept = FALSE,
  combine_method = c("ew", "convex", "positive", "unconstrained", "median",
    "convex_median", "rel_wis_weighted_median", "rel_wis_weighted_mean"),
  quantile_groups = NULL,
  noncross = "constrain",
  backend = "quantmod",
  do_q10_check,
  do_nondecreasing_quantile_check,
  do_baseline_check,
  do_sd_check,
  sd_check_table_path = NULL,
  sd_check_plot_path = NULL,
  baseline_tol = 1.2,
  manual_eligibility_adjust,
  return_all = FALSE,
  return_eligibility = TRUE
)

Arguments

forecasts

data frame with columns 'model', 'location', 'forecast_week_end_date', 'target', 'quantile', and 'value'

observed_by_location_target_end_date

data frame with columns 'location', 'base_target', 'target_end_date', and 'observed'

forecast_week_end_date

Date object: date of the saturday for the end of the forecast week; week-ahead targets are with respect to this date

window_size

size of window

intercept

logical specifying whether an intercept is included

combine_method

character specifying the approach to model combination: "equal", "convex", "positive", "unconstrained", "median", or "convex_median". The first four form a linear combination of quantiles across component models with varying levels of restrictions on the combination coefficients. "median" takes the median across models at each quantile level, and "convex_median" uses a weighted median with convext constraints on weights

quantile_groups

Vector of group labels for quantiles, having the same length as the number of quantiles. Common labels indicate that the ensemble weights for the corresponding quantile levels should be tied together. Default is rep(1,length(quantiles)), which means that a common set of ensemble weights should be used across all levels. This is the argument tau_groups for quantmod::quantile_ensemble, and may only be supplied if ⁠backend = 'quantmod⁠

noncross

string specifying approach to handling quantile noncrossing: one of "constrain" or "sort". "constrain" means estimation is done subject to constraints ruling out quantile crossing. "sort" means no such constraints are imposed during estimation, but the resulting forecasts are sorted.

backend

back end used for optimization.

do_q10_check

if TRUE, do q10 check

do_nondecreasing_quantile_check

if TRUE, do nondecreasing quantile check

return_all

if TRUE, return all quantities; if FALSE, return only some useful summaries

return_eligibility

if TRUE, return model eligibility

Value

tibble or data frame with ensemble fits and results


reichlab/covidEnsembles documentation built on Jan. 31, 2024, 7:21 p.m.