ForecasterX

scalation.modeling.forecasting.ForecasterX
trait ForecasterX(lags: Int)

The ForecasterX trait provides a common framework for several forecasting models that use 1 ENDOGENOUS variable y and 0 or more EXOGENOUS variables xj. It provides methods for multi-horizon (1 to h) forecasting using the RECURSIVE technique. Forecasted values are produced only for the endogenous variable y. Lower case indicates actual values, while upper case is for forecasted values.

Y_t+1 = f(y_t, y_t-1, ... y_t-p+1, x0_t, x0_t-1, ... x0_t-p+1, x1_t, ...) Y_t+2 = f(Y_t+1, y_t, ... y_t-p+2, x0_t, x0_t-1, ... x0_t-p+1, x1_t, ...) ... Y_t+h = f(Y_t+1, y_t, ... y_t-p+2, x0_t, x0_t-1, ... x0_t-p+1, x1_t, ...)

Value parameters

lags

the lags (p) used for endogenous variable (e.g., 10 => use lags 1 to 10)

Attributes

See also

Forecaster - when there are no exogenous variables

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ARX
class ARX_Quad

Members list

Value members

Abstract methods

def forecast(t: Int, yf: MatrixD, h: Int): VectorD

Produce a vector of size h, of 1 through h-steps ahead forecasts for the model. forecast the following time points: t+1, ..., t+h. Note, must create the yf matrix before calling the forecast method. Intended to work with rolling validation (analog of predict method)

Produce a vector of size h, of 1 through h-steps ahead forecasts for the model. forecast the following time points: t+1, ..., t+h. Note, must create the yf matrix before calling the forecast method. Intended to work with rolling validation (analog of predict method)

Value parameters

h

the forecasting horizon, number of steps ahead to produce forecasts

t

the time point from which to make forecasts

yf

the forecasting matrix for the endogenous variable y (time x horizons)

Attributes

def forecastAt(yf: MatrixD, yx: MatrixD, h: Int): VectorD

Forecast values for all y_.dim time points at horizon h (h-steps ahead). Assign into forecasting matrix and return the h-steps ahead forecast.

Forecast values for all y_.dim time points at horizon h (h-steps ahead). Assign into forecasting matrix and return the h-steps ahead forecast.

Value parameters

h

the forecasting horizon, number of steps ahead to produce forecasts

yf

the forecasting matrix for the endogenous variable y (time x horizons)

yx

the matrix of endogenous y and exogenous x values

Attributes

def testF(h: Int, y_: VectorD, yx: MatrixD): (VectorD, VectorD, VectorD)

Test FORECASTS at horizon h of a forecasting model y_ = f(lags (y_), x) + e and RETURN (1) aligned actual values, (2) the forecasts and (3) QoF vector. Testing may be in-sample (on the training set) or out-of-sample (on the testing set) as determined by the parameters passed in. Note: must call train and forecastAll before testF.

Test FORECASTS at horizon h of a forecasting model y_ = f(lags (y_), x) + e and RETURN (1) aligned actual values, (2) the forecasts and (3) QoF vector. Testing may be in-sample (on the training set) or out-of-sample (on the testing set) as determined by the parameters passed in. Note: must call train and forecastAll before testF.

Value parameters

h

the forecasting horizon, number of steps ahead to produce forecasts

y_

the testing/full response/output vector

yx

the matrix of endogenous y and exogenous x values

Attributes

Concrete methods

def forecastAll(y_: VectorD, yx: MatrixD, h: Int): MatrixD

Forecast values for all y_.dim time points and all horizons (1 through h-steps ahead). Record these in the yf matrix, where yf(t, k) = k-steps ahead forecast for y_t Note, column 0, yf(?, 0), is set to y (the actual time-series values). Forecast recursively down diagonals in the yf forecasting matrix. The top right and bottom left triangles in yf matrix are not forecastable.

Forecast values for all y_.dim time points and all horizons (1 through h-steps ahead). Record these in the yf matrix, where yf(t, k) = k-steps ahead forecast for y_t Note, column 0, yf(?, 0), is set to y (the actual time-series values). Forecast recursively down diagonals in the yf forecasting matrix. The top right and bottom left triangles in yf matrix are not forecastable.

Value parameters

h

the maximum forecasting horizon, number of steps ahead to produce forecasts

y_

the actual values to use in making forecasts

yx

the matrix of endogenous y and exogenous x values

Attributes

def testHorizons(h: Int, y_: VectorD, yx: MatrixD): Unit

Test FORECASTS over horizons 1 to h of a forecasting model y_ = f(lags (y_), x) + e and return its forecasts and QoF vector. Testing may be in-sample (on the training set) or out-of-sample (on the testing set) as determined by the parameters passed in. Note: must call train and forecastAll before testHorizons.

Test FORECASTS over horizons 1 to h of a forecasting model y_ = f(lags (y_), x) + e and return its forecasts and QoF vector. Testing may be in-sample (on the training set) or out-of-sample (on the testing set) as determined by the parameters passed in. Note: must call train and forecastAll before testHorizons.

Value parameters

h

the forecasting horizon, number of steps ahead to produce forecasts

y_

the testing/full response/output vector

yx

the matrix of endogenous y and exogenous x values

Attributes

protected def testSetupF(y_: VectorD, yx: MatrixD, h: Int, doPlot: Boolean): (VectorD, VectorD)

Set up testing by making h-steps ahead FORECASTS, and then aligning actual and forecasted values. Helper method for implementations of testF method. DROP the first h elements.

Set up testing by making h-steps ahead FORECASTS, and then aligning actual and forecasted values. Helper method for implementations of testF method. DROP the first h elements.

Value parameters

doPlot

whether to plot predicted and actual values vs. time t

h

the forecasting horizon, number of steps ahead to produce forecasts

y_

the testing/full response/output vector

yx

the matrix of endogenous y and exogenous x values

Attributes

Concrete fields

protected var yf: MatrixD