makeForecastData: Build a ensemble forecasting data object

Description Usage Arguments Value Examples

Description

This function uses the component model forecasts and dependent variable observations provided by the user to create an object of class ForecastData, which can then be used to calibrate and fit the ensemble. Individual slots of the ForecastData object can be accessed and changed using the get and set functions respectively. Missing predictions are allowed in the calibration set.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
makeForecastData(
  .predCalibration = array(NA, dim = c(0, 0, 0)),
  .predTest = array(NA, dim = c(0, 0, 0)),
  .outcomeCalibration = numeric(),
  .outcomeTest = numeric(),
  .modelNames = character(),
  ...
)

## S4 method for signature 'ANY'
makeForecastData(
  .predCalibration,
  .predTest,
  .outcomeCalibration,
  .outcomeTest,
  .modelNames
)

Arguments

.predCalibration

A matrix with the number of rows being the number of observations in the calibration period and a column with calibration period predictions for each model.

.predTest

A vector with the number of rows being the number of observations in the test period and a column with test period predictions for each model.

.outcomeCalibration

A vector with the true values of the dependent variable for each observation in the calibration period.

.outcomeTest

A vector with the true values of the dependent variable for each observation in the test period.

.modelNames

A vector of length p with the names of the component models.

...

Additional arguments not implemented

Value

A data object of the class 'ForecastData' with the following slots:

predCalibration

An array containing the predictions of all component models for all observations in the calibration period.

predTest

An array containing the predictions of all component models for all observations in the test period.

outcomeCalibration

A vector containing the true values of the dependent variable for all observations in the calibration period.

outcomeTest

A vector containing the true values of the dependent variable for all observations in the test period.

modelNames

A character vector containing the names of all component models. If no model names are specified, names will be assigned automatically.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
data(calibrationSample)
data(testSample)
this.ForecastData <- makeForecastData(.predCalibration=calibrationSample[,c("LMER", "SAE", "GLM")],
.outcomeCalibration=calibrationSample[,"Insurgency"],.predTest=testSample[,c("LMER", "SAE", "GLM")],
.outcomeTest=testSample[,"Insurgency"], .modelNames=c("LMER", "SAE", "GLM"))

### to acces individual slots in the ForecastData object
getPredCalibration(this.ForecastData)
getOutcomeCalibration(this.ForecastData)
getPredTest(this.ForecastData)
getOutcomeTest(this.ForecastData)
getModelNames(this.ForecastData)

### to assign individual slots, use set functions

setPredCalibration(this.ForecastData)<-calibrationSample[,c("LMER", "SAE", "GLM")]
setOutcomeCalibration(this.ForecastData)<-calibrationSample[,"Insurgency"]
setPredTest(this.ForecastData)<-testSample[,c("LMER", "SAE", "GLM")]
setOutcomeTest(this.ForecastData)<-testSample[,"Insurgency"]
setModelNames(this.ForecastData)<-c("LMER", "SAE", "GLM")

## End(Not run)

EBMAforecast documentation built on Oct. 29, 2020, 1:07 a.m.