knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

EBMAhelper

Travis build status CRAN status Coverage status

EBMAhelper is a wrapper around EBMAforecast (CRAN, GitHub) that provides some convenience functions more akin to R's conventional model-related functions:

and a standalone predict() (TODO) method to aggregate new forecasts.

Installation

library("devtools")

install_github("andybega/EBMAhelper")

Example

A EBMA ensemble can be fitted like this:

suppressMessages({
  library("EBMAforecast")
  library("EBMAhelper")
})


data("presidentialForecast")

head(presidentialForecast)
str(presidentialForecast)

fitted_ensemble <- ebma(y = presidentialForecast[ ,7],
                        x = presidentialForecast[ ,c(1:6)],
                        model_type = "normal")
summary(fitted_ensemble)

To do the same with EBMAforecast is slightly more verbose and does not follow R's model fitting conventions. The following code is adapted from the package demo:

data("presidentialForecast")

full.forecasts <- presidentialForecast[, c(1:6)]
full.observed <- presidentialForecast[, 7]

this.ForecastData <- makeForecastData(
  .predCalibration=full.forecasts[1:12,],
  .outcomeCalibration=full.observed[1:12],
  .predTest=full.forecasts[13:15,], 
  .outcomeTest=full.observed[13:15], 
  .modelNames=c("Campbell", "Lewis-Beck","EWT2C2","Fair","Hibbs","Abramowitz"))
thisEnsemble <- calibrateEnsemble(this.ForecastData, model="normal", 
                                  useModelParams=FALSE, tol = 0.000000001,
                                  const = 0)
summary(thisEnsemble)


andybega/EBMAhelper documentation built on April 6, 2022, 11:11 a.m.