Interface UpdatingMultipleLinearRegression

All Known Implementing Classes:
MillerUpdatingRegression, SimpleRegression

public interface UpdatingMultipleLinearRegression
An interface for regression models allowing for dynamic updating of the data. That is, the entire data set need not be loaded into memory. As observations become available, they can be added to the regression model and an updated estimate regression statistics can be calculated.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addObservation(double[] x, double y)
    Adds one observation to the regression model.
    void
    addObservations(double[][] x, double[] y)
    Adds a series of observations to the regression model.
    void
    Clears internal buffers and resets the regression model.
    long
    Returns the number of observations added to the regression model.
    boolean
    Returns true if a constant has been included false otherwise.
    Performs a regression on data present in buffers and outputs a RegressionResults object
    regress(int[] variablesToInclude)
    Performs a regression on data present in buffers including only regressors indexed in variablesToInclude and outputs a RegressionResults object
  • Method Details

    • hasIntercept

      boolean hasIntercept()
      Returns true if a constant has been included false otherwise.
      Returns:
      true if constant exists, false otherwise
    • getN

      long getN()
      Returns the number of observations added to the regression model.
      Returns:
      Number of observations
    • addObservation

      void addObservation(double[] x, double y) throws MathIllegalArgumentException
      Adds one observation to the regression model.
      Parameters:
      x - the independent variables which form the design matrix
      y - the dependent or response variable
      Throws:
      MathIllegalArgumentException - if the length of x does not equal the number of independent variables in the model
    • addObservations

      void addObservations(double[][] x, double[] y) throws MathIllegalArgumentException
      Adds a series of observations to the regression model. The lengths of x and y must be the same and x must be rectangular.
      Parameters:
      x - a series of observations on the independent variables
      y - a series of observations on the dependent variable The length of x and y must be the same
      Throws:
      MathIllegalArgumentException - if x is not rectangular, does not match the length of y or does not contain sufficient data to estimate the model
    • clear

      void clear()
      Clears internal buffers and resets the regression model. This means all data and derived values are initialized
    • regress

      Performs a regression on data present in buffers and outputs a RegressionResults object
      Returns:
      RegressionResults acts as a container of regression output
      Throws:
      MathIllegalArgumentException - if the model is not correctly specified
      MathIllegalArgumentException - if there is not sufficient data in the model to estimate the regression parameters
    • regress

      RegressionResults regress(int[] variablesToInclude) throws MathIllegalArgumentException
      Performs a regression on data present in buffers including only regressors indexed in variablesToInclude and outputs a RegressionResults object
      Parameters:
      variablesToInclude - an array of indices of regressors to include
      Returns:
      RegressionResults acts as a container of regression output
      Throws:
      MathIllegalArgumentException - if the model is not correctly specified
      MathIllegalArgumentException - if the variablesToInclude array is null or zero length