ForecasterX

scalation.modeling.forecasting_old.ForecasterX
See theForecasterX companion object
trait ForecasterX(lags: Int) extends Model

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

Companion
object
Graph
Supertypes
trait Model
class Object
trait Matchable
class Any
Known subtypes

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 forecast 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 FORECAST MATRIX and return the h-steps ahead forecast. Note, predictAll provides predictions for h = 1.

Forecast values for all y_.dim time points at horizon h (h-steps ahead). Assign into FORECAST MATRIX and return the h-steps ahead forecast. Note, predictAll provides predictions for h = 1.

Value parameters

h

the forecasting horizon, number of steps ahead to produce forecasts

yf

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

yx

the matrix of endogenous y and exogenous x values

Attributes

Get the internally row trimed and column expanded input matrix and response vector.

Get the internally row trimed and column expanded input matrix and response vector.

Attributes

def predict(t: Int, yx: MatrixD): Double

Predict a value for y_t+1 using the 1-step ahead forecast. y_t+1 = f (y_t, ...) + e_t+1

Predict a value for y_t+1 using the 1-step ahead forecast. y_t+1 = f (y_t, ...) + e_t+1

Value parameters

t

the time point from which to make prediction

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 FORECAST MATRIX yf, 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). last column, yf(?, h+1), is set to t (the time values, for reference). Forecast recursively down diagonals in the yf forecast 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 FORECAST MATRIX yf, 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). last column, yf(?, h+1), is set to t (the time values, for reference). Forecast recursively down diagonals in the yf forecast 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 forecastAtI(y_: VectorD, yfh: VectorD, h: Int, p: Double): (VectorD, VectorD)

Forecast intervals for all y_.dim time points at horizon h (h-steps ahead). Create prediction intervals (two vectors) for the given time points at level p. Caveat: assumes errors follow a Normal distribution. Override this method to handle other cases.

Forecast intervals for all y_.dim time points at horizon h (h-steps ahead). Create prediction intervals (two vectors) for the given time points at level p. Caveat: assumes errors follow a Normal distribution. Override this method to handle other cases.

Value parameters

h

the forecasting horizon, number of steps ahead to produce forecasts

p

the level (1 - alpha) for the prediction interval

y_

the aligned actual values to use in making forecasts

yfh

the forecast vector at horizon h

Attributes

Inherited methods

def getYY: MatrixD

Return the used response matrix y, if needed.

Return the used response matrix y, if needed.

Attributes

See also

neuralnet.PredictorMV

Inherited from:
Model
def report(ftMat: MatrixD): String

Return a basic report on a trained and tested multi-variate model.

Return a basic report on a trained and tested multi-variate model.

Value parameters

ftMat

the matrix of qof values produced by the Fit trait

Attributes

Inherited from:
Model
def report(ftVec: VectorD): String

Return a basic report on a trained and tested model.

Return a basic report on a trained and tested model.

Value parameters

ftVec

the vector of qof values produced by the Fit trait

Attributes

Inherited from:
Model

Inherited and Abstract methods

def crossValidate(k: Int, rando: Boolean): Array[Statistic]

Attributes

Inherited from:
Model
def getFname: Array[String]

Return the feature/variable names.

Return the feature/variable names.

Attributes

Inherited from:
Model
def getX: MatrixD

Return the used data matrix x. Mainly for derived classes where x is expanded from the given columns in x_, e.g., SymbolicRegression.quadratic adds squared columns.

Return the used data matrix x. Mainly for derived classes where x is expanded from the given columns in x_, e.g., SymbolicRegression.quadratic adds squared columns.

Attributes

Inherited from:
Model
def getY: VectorD

Return the used response vector y. Mainly for derived classes where y is transformed, e.g., TranRegression, ARX.

Return the used response vector y. Mainly for derived classes where y is transformed, e.g., TranRegression, ARX.

Attributes

Inherited from:
Model

Return the model hyper-parameters (if none, return null). Hyper-parameters may be used to regularize parameters or tune the optimizer.

Return the model hyper-parameters (if none, return null). Hyper-parameters may be used to regularize parameters or tune the optimizer.

Attributes

Inherited from:
Model

Return the vector of model parameter/coefficient values. Single output models have VectorD parameters, while multi-output models have MatrixD.

Return the vector of model parameter/coefficient values. Single output models have VectorD parameters, while multi-output models have MatrixD.

Attributes

Inherited from:
Model
def predict(z: VectorD): Double | VectorD

Predict the value of y = f(z) by evaluating the model equation. Single output models return Double, while multi-output models return VectorD.

Predict the value of y = f(z) by evaluating the model equation. Single output models return Double, while multi-output models return VectorD.

Value parameters

z

the new vector to predict

Attributes

Inherited from:
Model
def test(x_: MatrixD, y_: VectorD): (VectorD, VectorD)

Test/evaluate the model's Quality of Fit (QoF) and return the predictions and QoF vectors. This may include the importance of its parameters (e.g., if 0 is in a parameter's confidence interval, it is a candidate for removal from the model). Extending traits and classess should implement various diagnostics for the test and full (training + test) datasets.

Test/evaluate the model's Quality of Fit (QoF) and return the predictions and QoF vectors. This may include the importance of its parameters (e.g., if 0 is in a parameter's confidence interval, it is a candidate for removal from the model). Extending traits and classess should implement various diagnostics for the test and full (training + test) datasets.

Value parameters

x_

the testiing/full data/input matrix (impl. classes may default to x)

y_

the testiing/full response/output vector (impl. classes may default to y)

Attributes

Inherited from:
Model
def train(x_: MatrixD, y_: VectorD): Unit

Train the model 'y_ = f(x_) + e' on a given dataset, by optimizing the model parameters in order to minimize error '||e||' or maximize log-likelihood 'll'.

Train the model 'y_ = f(x_) + e' on a given dataset, by optimizing the model parameters in order to minimize error '||e||' or maximize log-likelihood 'll'.

Value parameters

x_

the training/full data/input matrix (impl. classes may default to x)

y_

the training/full response/output vector (impl. classes may default to y)

Attributes

Inherited from:
Model

Inherited fields

var modelConcept: URI

The optional reference to an ontological concept

The optional reference to an ontological concept

Attributes

Inherited from:
Model
var modelName: String

The name for the model (or modeling technique).

The name for the model (or modeling technique).

Attributes

Inherited from:
Model