A function to compare forecasts. Options include: simple forecast error ratios, Diebold-Mariano test, and Clark and West test for nested models

forecast_comparison(
  Data,
  baseline.forecast,
  test = "ER",
  loss = "MSE",
  horizon = NULL
)

Arguments

Data

data.frame: data frame of forecasts, model names, and dates

baseline.forecast

string: column name of baseline (null hypothesis) forecasts

test

string: which test to use; ER = error ratio, DM = Diebold-Mariano, CM = Clark and West

loss

string: error loss function to use if creating forecast error ratio

horizon

int: horizon of forecasts being compared in DM and CW tests

Value

numeric test result