Top Description Methods
org.apache.commons.math3.stat.regression

public Interface UpdatingMultipleLinearRegression

Known Direct Implementers
org.apache.commons.math3.stat.regression.MillerUpdatingRegression, org.apache.commons.math3.stat.regression.SimpleRegression
Imports
org.apache.commons.math3.exception.MathIllegalArgumentException, .NoDataException

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.
Since
3.0

Method Summary

Modifier and TypeMethod and Description
public void
addObservation(double[]
the independent variables which form the design matrix
x
,
double
the dependent or response variable
y
)

Adds one observation to the regression model.

public void
addObservations(double[][]
a series of observations on the independent variables
x
,
double[]
a series of observations on the dependent variable The length of x and y must be the same
y
)

Adds a series of observations to the regression model.

public void
clear()

Clears internal buffers and resets the regression model.

public long

Returns:

Number of observations
getN
()

Returns the number of observations added to the regression model.

public boolean

Returns:

true if constant exists, false otherwise
hasIntercept
()

Returns true if a constant has been included false otherwise.

public RegressionResults

Returns:

RegressionResults acts as a container of regression output
regress
()

Performs a regression on data present in buffers and outputs a RegressionResults object

public RegressionResults

Returns:

RegressionResults acts as a container of regression output
regress
(int[]
an array of indices of regressors to include
variablesToInclude
)

Performs a regression on data present in buffers including only regressors indexed in variablesToInclude and outputs a RegressionResults object

Method Detail

addObservationback to summary
public void addObservation(double[] x, double y) throws ModelSpecificationException

Adds one observation to the regression model.

Parameters
x:double[]

the independent variables which form the design matrix

y:double

the dependent or response variable

Exceptions
ModelSpecificationException:
if the length of x does not equal the number of independent variables in the model
addObservationsback to summary
public void addObservations(double[][] x, double[] y) throws ModelSpecificationException

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:double[][]

a series of observations on the independent variables

y:double[]

a series of observations on the dependent variable The length of x and y must be the same

Exceptions
ModelSpecificationException:
if x is not rectangular, does not match the length of y or does not contain sufficient data to estimate the model
clearback to summary
public void clear()

Clears internal buffers and resets the regression model. This means all data and derived values are initialized

getNback to summary
public long getN()

Returns the number of observations added to the regression model.

Returns:long

Number of observations

hasInterceptback to summary
public boolean hasIntercept()

Returns true if a constant has been included false otherwise.

Returns:boolean

true if constant exists, false otherwise

regressback to summary
public RegressionResults regress() throws ModelSpecificationException, NoDataException

Performs a regression on data present in buffers and outputs a RegressionResults object

Returns:RegressionResults

RegressionResults acts as a container of regression output

Exceptions
ModelSpecificationException:
if the model is not correctly specified
NoDataException:
if there is not sufficient data in the model to estimate the regression parameters
regressback to summary
public RegressionResults regress(int[] variablesToInclude) throws ModelSpecificationException, MathIllegalArgumentException

Performs a regression on data present in buffers including only regressors indexed in variablesToInclude and outputs a RegressionResults object

Parameters
variablesToInclude:int[]

an array of indices of regressors to include

Returns:RegressionResults

RegressionResults acts as a container of regression output

Exceptions
ModelSpecificationException:
if the model is not correctly specified
MathIllegalArgumentException:
if the variablesToInclude array is null or zero length