Packages

class MA_1 extends ForecasterVec with NoFeatureSelectionF

The MA_1 class provides basic time series analysis capabilities for 'MA_1' models. In an 'MA_1' model, 1 refers to the order of the Moving-Average component of the model. MA_1 models are often used for forecasting. Given time series data stored in vector 'y', its next value 'y_t = y(t)' may be predicted based on the noise/residuals/shocks:

y_t = c + θ e_t-i + e_t

where 'c' is a constant, 'θ' is the moving-average parameters vector, and 'e' is the noise vector. ------------------------------------------------------------------------------

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MA_1
  2. NoFeatureSelectionF
  3. ForecasterVec
  4. Predictor
  5. Model
  6. Fit
  7. Error
  8. QoF
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new MA_1(y: VectoD, hparam: HyperParameter = null)

    y

    the response vector (time series data)

    hparam

    the hyper-parameters

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def acF: VectoD

    Return the autocorrelation.

    Return the autocorrelation. Must call 'train' first.

    Definition Classes
    ForecasterVec
  5. def analyze(x_: MatriD = null, y_: VectoD = y, x_e: MatriD = null, y_e: VectoD = y): ForecasterVec

    Analyze a dataset using this model using ordinary training with the 'train' method.

    Analyze a dataset using this model using ordinary training with the 'train' method.

    x_

    the training/full the data/input matrix (ignore)

    y_

    the training/full the response/output vector

    x_e

    the test/full data/input matrix (ignore)

    y_e

    the test/full response/output vector

    Definition Classes
    ForecasterVecPredictor
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  8. def corrMatrix(xx: MatriD): MatriD

    Return the correlation matrix for the columns in data matrix 'xx'.

    Return the correlation matrix for the columns in data matrix 'xx'.

    xx

    the data matrix shose correlation matrix is sought

    Definition Classes
    Predictor
  9. def csse(θ: Double): Double

    Given a value for parameter 'θ', compute the Conditional Sum of Squared Errors.

    Given a value for parameter 'θ', compute the Conditional Sum of Squared Errors.

    θ

    the given θ parameters

    See also

    people.stat.sc.edu/hitchcock/stat520ch7slides.pdf

  10. def diagnose(e: VectoD, yy: VectoD, yp: VectoD, w: VectoD = null, ym_: Double = noDouble): Unit

    Diagnose the health of the model by computing the Quality of Fit (QoF) measures, from the error/residual vector and the predicted & actual responses.

    Diagnose the health of the model by computing the Quality of Fit (QoF) measures, from the error/residual vector and the predicted & actual responses. For some models the instances may be weighted.

    e

    the m-dimensional error/residual vector (yy - yp)

    yy

    the actual response/output vector to use (test/full)

    yp

    the predicted response/output vector (test/full)

    w

    the weights on the instances (defaults to null)

    ym_

    the mean of the actual response/output vector to use (training/full)

    Definition Classes
    FitQoF
    See also

    Regression_WLS

  11. var e: VectoD
    Attributes
    protected
    Definition Classes
    ForecasterVec
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  14. def eval(y_e: VectoD = y): ForecasterVec

    Compute the error (difference between actual and predicted) and useful diagnostics for the dataset.

    Compute the error (difference between actual and predicted) and useful diagnostics for the dataset.

    y_e

    the test/full actual response/output vector

    Definition Classes
    ForecasterVec
  15. def eval(x_e: MatriD, y_e: VectoD): ForecasterVec

    Compute the error (difference between actual and predicted) and useful diagnostics for the dataset.

    Compute the error (difference between actual and predicted) and useful diagnostics for the dataset.

    x_e

    the test/full data/input matrix (ignored, pass null)

    y_e

    the test/full actual response/output vector

    Definition Classes
    ForecasterVecModel
  16. def evalf(y_e: VectoD, yf: VectoD): ForecasterVec

    Compute the error (difference between actual and predicted) and useful diagnostics for the dataset.

    Compute the error (difference between actual and predicted) and useful diagnostics for the dataset.

    y_e

    the test/full actual response/output vector

    yf

    the vector of forecasts

    Definition Classes
    ForecasterVec
  17. def f_(z: Double): String

    Format a double value.

    Format a double value.

    z

    the double value to format

    Definition Classes
    QoF
  18. def fit: VectoD

    Return the Quality of Fit (QoF) measures corresponding to the labels given above in the 'fitLabel' method.

    Return the Quality of Fit (QoF) measures corresponding to the labels given above in the 'fitLabel' method. Note, if 'sse > sst', the model introduces errors and the 'rSq' may be negative, otherwise, R^2 ('rSq') ranges from 0 (weak) to 1 (strong). Override to add more quality of fit measures.

    Definition Classes
    FitQoF
  19. def fitLabel: Seq[String]

    Return the labels for the Quality of Fit (QoF) measures.

    Return the labels for the Quality of Fit (QoF) measures. Override to add additional QoF measures.

    Definition Classes
    FitQoF
  20. def fitMap: Map[String, String]

    Build a map of quality of fit measures (use of LinkedHashMap makes it ordered).

    Build a map of quality of fit measures (use of LinkedHashMap makes it ordered).

    Definition Classes
    QoF
  21. final def flaw(method: String, message: String): Unit
    Definition Classes
    Error
  22. def forecast(t: Int, h: Int = 1): VectoD

    Produce a vector of size 'h', of 1 through 'h'-steps ahead forecasts for the model.

    Produce a vector of size 'h', of 1 through 'h'-steps ahead forecasts for the model.

    forecast the following time points: t, t+1, ..., t-1+h.

    Note, invoke 'forecastAll' first to create the 'yf' matrix.

    t

    the time point from which to make forecasts

    h

    the forecasting horizon, number of steps ahead to produce forecasts

    Definition Classes
    ForecasterVec
  23. def forecast(yf: MatriD, t: Int, h: Int): VectoD

    Produce a vector of size 'h', of 1 through 'h'-steps ahead forecasts for the model.

    Produce a vector of size 'h', of 1 through 'h'-steps ahead forecasts for the model.

    forecast the following time points: t, t+1, ..., t-1+h.

    Note, invoke 'forecastAll' to create the 'yf' matrix.

    yf

    the y-forecast matrix for all time and horizons

    t

    the time point from which to make forecasts

    h

    the forecasting horizon, number of steps ahead to produce forecasts

    Definition Classes
    ForecasterVec
  24. def forecastAll(h: Int): MatriD

    Forecast values for all 'm' time points and all horizons (1 through 'h'-steps ahead).

    Forecast values for all 'm' 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, 'yf.col(0)' is set to 'y' (the actual time-series values).

    h

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

    Definition Classes
    MA_1ForecasterVec
  25. def forecastAll(h: Int, p: Int): MatriD

    Forecast values for all time points using 1 through 'h'-steps ahead forecasts.

    Forecast values for all time points using 1 through 'h'-steps ahead forecasts. The 'h'-th row of matrix is the horizon 'h' forecast (where 'h = 0' is actual data).

    h

    the forecasting horizon, number of steps ahead to produce forecasts, must be > 0

    p

    the order of the model (e.g, p in AR, q in MA) or number of values to use in making forecasts, must be > 0

    Definition Classes
    ForecasterVec
  26. def forecastX(y: VectoD, t: Int, h: Int = 1): Double

    Produce h-steps ahead forecast on the testing data during cross validation.

    Produce h-steps ahead forecast on the testing data during cross validation. Likely to need overriding.

    y

    the current response vector

    t

    the time point/index to be forecast

    h

    the forecasting horizon, number of steps ahead to produce forecast

    Definition Classes
    ForecasterVec
  27. def forwardSel(cols: Set[Int], index_q: Int): (Int, ForecasterVec)
    Definition Classes
    NoFeatureSelectionF
  28. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  29. def getX: MatriD

    Return the 'used' data matrix 'x' (for such models, it's null).

    Return the 'used' data matrix 'x' (for such models, it's null).

    Definition Classes
    ForecasterVecPredictor
  30. def getY: VectoD

    Return the 'used' response vector 'y'.

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

    Definition Classes
    ForecasterVecPredictor
  31. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  32. def help: String

    Return the help string that describes the Quality of Fit (QoF) measures provided by the Fit class.

    Return the help string that describes the Quality of Fit (QoF) measures provided by the Fit class. Override to correspond to 'fitLabel'.

    Definition Classes
    FitQoF
  33. def hparameter: HyperParameter

    Return the hyper-parameters.

    Return the hyper-parameters.

    Definition Classes
    ForecasterVecModel
  34. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  35. def ll(ms: Double = mse0, s2: Double = sig2e, m2: Int = m): Double

    The log-likelihood function times -2.

    The log-likelihood function times -2. Override as needed.

    ms

    raw Mean Squared Error

    s2

    MLE estimate of the population variance of the residuals

    Definition Classes
    Fit
    See also

    www.stat.cmu.edu/~cshalizi/mreg/15/lectures/06/lecture-06.pdf

    www.wiley.com/en-us/Introduction+to+Linear+Regression+Analysis%2C+5th+Edition-p-9780470542811 Section 2.11

  36. val m: Int
    Attributes
    protected
    Definition Classes
    ForecasterVec
  37. val ml: Int
    Attributes
    protected
    Definition Classes
    ForecasterVec
  38. val modelConcept: URI

    An optional reference to an ontological concept

    An optional reference to an ontological concept

    Definition Classes
    Model
  39. def modelName: String

    An optional name for the model (or modeling technique)

    An optional name for the model (or modeling technique)

    Definition Classes
    Model
  40. def mse_: Double

    Return the mean of squares for error (sse / df._2).

    Return the mean of squares for error (sse / df._2). Must call diagnose first.

    Definition Classes
    Fit
  41. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  42. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  43. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  44. def pacF: VectoD

    Return the partial autocorrelation.

    Return the partial autocorrelation. Must call 'train' first.

    Definition Classes
    ForecasterVec
  45. var pacf: VectoD
    Attributes
    protected
    Definition Classes
    ForecasterVec
  46. def parameter: VectoD

    Return the parameter vector (θ).

    Return the parameter vector (θ).

    Definition Classes
    MA_1Model
  47. def plotFunc(fVec: VectoD, name: String, show: Boolean = true): Unit

    Plot a function, e.g., Auto-Correlation Function 'ACF', Partial Auto-Correlation Function 'PACF'.

    Plot a function, e.g., Auto-Correlation Function 'ACF', Partial Auto-Correlation Function 'PACF'.

    fVec

    the vector given function values

    name

    the name of the function

    show

    whether to show the fVec values

    Definition Classes
    ForecasterVec
  48. def plotFunc2(fVec: VectoD, name: String, show: Boolean = true): Unit

    Plot a function, e.g., Auto-Correlation Function 'ACF', Partial Auto-Correlation Function 'PACF' with confidence bound.

    Plot a function, e.g., Auto-Correlation Function 'ACF', Partial Auto-Correlation Function 'PACF' with confidence bound.

    fVec

    the vector given function values

    name

    the name of the function

    show

    whether to show the fVec values

    Definition Classes
    ForecasterVec
  49. def predict(z: MatriD): VectoD

    Predict the value of 'y = f(z)' for each row of matrix 'z'.

    Predict the value of 'y = f(z)' for each row of matrix 'z'.

    z

    the new matrix to predict

    Definition Classes
    ForecasterVecPredictor
  50. def predict(y_null: VectoD = null): Double

    Return the horizon 1 forecast beyond the end of the time-series.

    Return the horizon 1 forecast beyond the end of the time-series.

    y_null

    the actual response/output vector to use (ignored)

    Definition Classes
    ForecasterVecPredictor
  51. def predict(z: VectoI): Double

    Given a new discrete data/input vector 'z', predict the 'y'-value of 'f(z)'.

    Given a new discrete data/input vector 'z', predict the 'y'-value of 'f(z)'.

    z

    the vector to use for prediction

    Definition Classes
    Predictor
  52. def predictAll(): VectoD

    Return the vector of predicted values for all original data.

    Return the vector of predicted values for all original data. Undo initial zeroing of the data 'y - mu'.

    Definition Classes
    ForecasterVec
  53. def predictAllz(): VectoD

    Return a vector of centered predictions of an MA_1 model and update the residuals.

    Return a vector of centered predictions of an MA_1 model and update the residuals.

    Definition Classes
    MA_1ForecasterVec
  54. var psi: MatriD
    Attributes
    protected
    Definition Classes
    ForecasterVec
  55. def report: String

    Return a basic report on the trained model.

    Return a basic report on the trained model.

    Definition Classes
    ForecasterVecModel
  56. def resetDF(df_update: PairD): Unit

    Reset the degrees of freedom to the new updated values.

    Reset the degrees of freedom to the new updated values. For some models, the degrees of freedom is not known until after the model is built.

    df_update

    the updated degrees of freedom (model, error)

    Definition Classes
    Fit
  57. def residual: VectoD

    Return the vector of residuals/errors.

    Return the vector of residuals/errors.

    Definition Classes
    ForecasterVecPredictor
  58. var sig2e: Double
    Attributes
    protected
    Definition Classes
    Fit
  59. var stats: Stats
    Attributes
    protected
    Definition Classes
    ForecasterVec
  60. def summary: String

    Return a detailed summary of the trained model.

  61. def summary(b: String, modelEq: String): String

    Return a detailed summary of the trained model.

    Return a detailed summary of the trained model.

    b

    the symbol(s) used for the parameters

    modelEq

    the model equation as a string

    Definition Classes
    ForecasterVec
  62. def summary(b: VectoD, stdErr: VectoD, vf: VectoD, show: Boolean = false): String

    Produce a summary report with diagnostics for each predictor 'x_j' and the overall quality of fit.

    Produce a summary report with diagnostics for each predictor 'x_j' and the overall quality of fit.

    b

    the parameters/coefficients for the model

    vf

    the Variance Inflation Factors (VIFs)

    show

    flag indicating whether to print the summary

    Definition Classes
    Fit
  63. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  64. def test(modelName: String, doPlot: Boolean = true): Unit

    Test the model on the full dataset (i.e., train and evaluate on full dataset).

    Test the model on the full dataset (i.e., train and evaluate on full dataset).

    modelName

    the name of the model being tested

    doPlot

    whether to plot the actual vs. predicted response

    Definition Classes
    Predictor
  65. def toString(): String
    Definition Classes
    AnyRef → Any
  66. def train(x_null: MatriD, y_: VectoD): MA_1

    Train an MA_1 model on the time-series data in vector 'y_'.

    Train an MA_1 model on the time-series data in vector 'y_'. Estimate the parameters vector 'θ' for a 'q'th order a Moving-Average 'MA(1)' model.

    z_t = θ_0 * e_t-1 + e_t

    x_null

    the data/input vector (ignored)

    y_

    the response/output vector (currently only works for y)

    Definition Classes
    MA_1ForecasterVecModel
  67. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  68. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  69. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  70. var yf: MatriD
    Attributes
    protected
    Definition Classes
    ForecasterVec
  71. var z: VectoD
    Attributes
    protected
    Definition Classes
    ForecasterVec

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from NoFeatureSelectionF

Inherited from ForecasterVec

Inherited from Predictor

Inherited from Model

Inherited from Fit

Inherited from Error

Inherited from QoF

Inherited from AnyRef

Inherited from Any

Ungrouped