public class MultipleLinearRegression extends Object
Modifier and Type | Field and Description |
---|---|
private Vector |
b
The (p+1 x 1) - vector holding the estimated b-values (b0, b1, ..., bp)^T.
|
private Vector |
e
The (n x 1) - vector holding the estimated residuals (e1, ..., en)^T.
|
private double |
ssr
The sum of square residuals
|
private double |
sst
The sum of square totals
|
private double |
variance
The error variance.
|
private Matrix |
x
The (n x p+1)-matrix holding the x-values, where the i-th row has the form
(1 x1i ... x1p).
|
private Matrix |
xx_inverse
Holds the matrix (x'x)^-1.
|
private Vector |
y
The (n x 1) - vector holding the y-values (y1, ..., yn)^T.
|
private double |
y_mean
Holds the mean value of the y-values.
|
Constructor and Description |
---|
MultipleLinearRegression(Vector y,
Matrix x)
Provides a new multiple linear regression model with the specified
parameters.
|
Modifier and Type | Method and Description |
---|---|
double |
coefficientOfDetermination()
Returns the coefficient of determination
|
double |
estimateY(Matrix x)
Perform an estimation of y on the specified matrix.
|
Vector |
getEstimatedCoefficients()
Returns the estimated coefficients
|
Vector |
getEstimatedResiduals()
Returns the estimated residuals
|
double |
getSumOfSquareResiduals()
Returns the sum of square residuals.
|
double |
getSumOfSquaresTotal()
Returns the sum of squares total.
|
double |
getVariance()
Returns the error variance.
|
String |
toString()
Returns a string representation of the object.
|
private final Vector y
private final double y_mean
private final Matrix x
private final Vector b
private final Vector e
private final double variance
private final Matrix xx_inverse
private final double ssr
private final double sst
public MultipleLinearRegression(Vector y, Matrix x)
y
- the (n x 1) - vector holding the response values (y1, ..., yn)^T.x
- the (n x p+1)-matrix holding the explanatory values, where the
i-th row has the form (1 x1i ... x1p).public String toString()
public double getSumOfSquaresTotal()
public double getSumOfSquareResiduals()
public Vector getEstimatedCoefficients()
public Vector getEstimatedResiduals()
public double coefficientOfDetermination()
public double estimateY(Matrix x)
x
- the matrix for which y is estimatedpublic double getVariance()