public class LinearRegression extends Object implements EstimatableModel<double[],double[]>
| Constructor and Description |
|---|
LinearRegression()
linear regression model
|
| Modifier and Type | Method and Description |
|---|---|
LinearRegression |
clone()
Clone the model
|
boolean |
equals(Object obj) |
void |
estimate(double[][] yd,
double[][] xd)
As in
estimate(List) but using double arrays for efficiency. |
boolean |
estimate(List<? extends IndependentPair<double[],double[]>> data)
Estimates the model from the observations in the list of data.
|
void |
estimate(Jama.Matrix y,
Jama.Matrix x)
As in
estimate(List) but using double arrays for efficiency. |
int |
numItemsToEstimate() |
double[] |
predict(double[] data)
Uses the model to predict dependent data from an independent value.
|
Jama.Matrix |
predict(Jama.Matrix x)
Helper function which adds the constant component to x and returns
predicted values for y, one per row
|
String |
toString() |
public LinearRegression()
public boolean estimate(List<? extends IndependentPair<double[],double[]>> data)
EstimatableModelEstimatableModel.numItemsToEstimate() pairs of dependent
and independent data. It may contain more, in which case the estimate
method may choose to make use of this data for validation, or obtaining a
better model by a least squares method for example.estimate in interface EstimatableModel<double[],double[]>data - Data with which to estimate the modelEstimatableModel.numItemsToEstimate()public void estimate(double[][] yd, double[][] xd)
estimate(List) but using double arrays for efficiency.yd - xd - public void estimate(Jama.Matrix y, Jama.Matrix x)
estimate(List) but using double arrays for efficiency.
Estimates: b = V D^{-1} U^{T} y s.t. X = UDV^{T}y - x - public double[] predict(double[] data)
Modelpublic Jama.Matrix predict(Jama.Matrix x)
x - public int numItemsToEstimate()
numItemsToEstimate in interface EstimatableModel<double[],double[]>public LinearRegression clone()
EstimatableModelclone in interface EstimatableModel<double[],double[]>clone in class Object