get_imputed_ensemble_fits_and_predictions: Calculate ensemble fits after imputing missing forecasts

get_imputed_ensemble_fits_and_predictionsR Documentation

Calculate ensemble fits after imputing missing forecasts

Description

Calculate ensemble fits after imputing missing forecasts

Usage

get_imputed_ensemble_fits_and_predictions(
  forecasts,
  observed_by_location_target_end_date,
  forecast_week_end_date,
  window_size,
  intercept = FALSE,
  combine_method = c("ew", "median", "convex", "positive", "unconstrained",
    "convex_median", "rel_wis_weighted_median", "rel_wis_weighted_mean"),
  quantile_groups = NULL,
  noncross = "constrain",
  impute_method = "mean",
  weight_transfer_per_group = FALSE,
  weight_transfer_group_factors = "location",
  backend = "quantmod",
  check_missingness_by_target = FALSE,
  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,
  top_models = 0,
  max_weight = NULL,
  manual_eligibility_adjust,
  return_all = FALSE,
  return_eligibility = TRUE,
  partial_save_frequency,
  partial_save_filename
)

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.

impute_method

character string specifying method for imputing missing forecasts; either 'mean' for mean imputation or 'none' for no imputation

weight_transfer_per_group
weight_transfer_group_factors
backend

back end used for optimization.

check_missingness_by_target

if TRUE, record missingness for every combination of model, location, forecast week, and target; if FALSE, record missingness only for each model and location

do_q10_check

if TRUE, do q10 check

do_nondecreasing_quantile_check

if TRUE, do nondecreasing quantile check

do_baseline_check

if TRUE, do baseline quantile check

do_sd_check

if TRUE, do sd quantile check (for hospitalization forecasts)

sd_check_table_path

where to save hospitalization sd check table results

sd_check_plot_path

where to save hospitalization sd check plot results

max_weight

numeric value for maximum weight. Ignored unless combine_method is rel_wis_weighted_median or rel_wis_weighted mean and backend is grid_search

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.