| Modifier and Type | Field and Description |
|---|---|
| private boolean | noIntercept
Whether or not the regression model includes an intercept. |
| private RealMatrix | xMatrix
X sample data. |
| private RealVector | yVector
Y sample data. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract RealVector | |
| protected abstract RealMatrix | Returns: beta varianceCalculates the beta variance of multiple linear regression in matrix notation. |
| protected double | |
| protected RealVector | Returns: The residuals [n,1] matrixCalculates the residuals of multiple linear regression in matrix notation. |
| protected double | |
| public double | |
| public double | estimateRegressandVariance()
Implements org. Returns the variance of the regressand, ie Var(y). |
| public double[] | estimateRegressionParameters()
Implements org. Estimates the regression parameters b. |
| public double[] | estimateRegressionParametersStandardErrors()
Implements org. Returns the standard errors of the regression parameters. |
| public double[][] | estimateRegressionParametersVariance()
Implements org. Estimates the variance of the regression parameters, ie Var(b). |
| public double | Returns: regression standard errorEstimates the standard error of the regression. |
| public double[] | estimateResiduals()
Implements org. Estimates the residuals, ie u = y - X*b. |
| protected RealMatrix | |
| protected RealVector | |
| public boolean | |
| public void | newSampleData(double[]
input data array data, int number of observations (rows) nobs, int number of independent variables (columns, not counting y) nvars)Loads model x and y sample data from a flat input array, overriding any previous sample. |
| protected void | newXSampleData(double[][]
the rectangular array representing the x sample x)Loads new x sample data, overriding any previous data. |
| protected void | newYSampleData(double[]
the array representing the y sample y)Loads new y sample data, overriding any previous data. |
| public void | setNoIntercept(boolean
true means the model is to be estimated without an intercept term noIntercept)
|
| protected void | validateCovarianceData(double[][]
the [n,k] array representing the x sample x, double[][] the [n,n] array representing the covariance matrix covariance)Validates that the x data and covariance matrix have the same number of rows and that the covariance matrix is square. |
| protected void | validateSampleData(double[][]
the [n,k] array representing the x data x, double[] the [n,1] array representing the y data y)Validates sample data. |
| noIntercept | back to summary |
|---|---|
| private boolean noIntercept Whether or not the regression model includes an intercept. True means no intercept. | |
| xMatrix | back to summary |
|---|---|
| private RealMatrix xMatrix X sample data. | |
| yVector | back to summary |
|---|---|
| private RealVector yVector Y sample data. | |
| AbstractMultipleLinearRegression | back to summary |
|---|---|
| public AbstractMultipleLinearRegression() | |
| calculateBeta | back to summary |
|---|---|
| protected abstract RealVector calculateBeta() Calculates the beta of multiple linear regression in matrix notation.
| |
| calculateBetaVariance | back to summary |
|---|---|
| protected abstract RealMatrix calculateBetaVariance() Calculates the beta variance of multiple linear regression in matrix notation.
| |
| calculateErrorVariance | back to summary |
|---|---|
| protected double calculateErrorVariance() Calculates the variance of the error term. Uses the formulavar(u) = u · u / (n - k)where n and k are the row and column dimensions of the design matrix X.
| |
| calculateResiduals | back to summary |
|---|---|
| protected RealVector calculateResiduals() Calculates the residuals of multiple linear regression in matrix notation. u = y - X * b
| |
| calculateYVariance | back to summary |
|---|---|
| protected double calculateYVariance() Calculates the variance of the y values.
| |
| estimateErrorVariance | back to summary |
|---|---|
| public double estimateErrorVariance() Estimates the variance of the error.
| |
| estimateRegressandVariance | back to summary |
|---|---|
| public double estimateRegressandVariance() Implements org. Doc from org. Returns the variance of the regressand, ie Var(y).
| |
| estimateRegressionParameters | back to summary |
|---|---|
| public double[] estimateRegressionParameters() Implements org. Doc from org. Estimates the regression parameters b.
| |
| estimateRegressionParametersStandardErrors | back to summary |
|---|---|
| public double[] estimateRegressionParametersStandardErrors() Implements org. Returns the standard errors of the regression parameters.
| |
| estimateRegressionParametersVariance | back to summary |
|---|---|
| public double[][] estimateRegressionParametersVariance() Implements org. Estimates the variance of the regression parameters, ie Var(b).
| |
| estimateRegressionStandardError | back to summary |
|---|---|
| public double estimateRegressionStandardError() Estimates the standard error of the regression.
| |
| estimateResiduals | back to summary |
|---|---|
| public double[] estimateResiduals() Implements org. Doc from org. Estimates the residuals, ie u = y - X*b.
| |
| getX | back to summary |
|---|---|
protected RealMatrix getX()
| |
| getY | back to summary |
|---|---|
protected RealVector getY()
| |
| isNoIntercept | back to summary |
|---|---|
public boolean isNoIntercept()
| |
| newSampleData | back to summary |
|---|---|
| public void newSampleData(double[] data, int nobs, int nvars) Loads model x and y sample data from a flat input array, overriding any previous sample. Assumes that rows are concatenated with y values first in each row. For example, an input
y x[0] x[1] -------------- 1 2 3 4 5 6 7 8 9 Note that there is no need to add an initial unitary column (column of 1's) when
specifying a model including an intercept term. If Throws IllegalArgumentException if any of the following preconditions fail:
| |
| newXSampleData | back to summary |
|---|---|
| protected void newXSampleData(double[][] x) Loads new x sample data, overriding any previous data. The inputx array should have one row for each sample
observation, with columns corresponding to independent variables.
For example, if
then setXSampleData(x) results in a model with two independent
variables and 3 observations:
x[0] x[1]
----------
1 2
3 4
5 6
Note that there is no need to add an initial unitary column (column of 1's) when specifying a model including an intercept term.
| |
| newYSampleData | back to summary |
|---|---|
| protected void newYSampleData(double[] y) Loads new y sample data, overriding any previous data.
| |
| setNoIntercept | back to summary |
|---|---|
public void setNoIntercept(boolean noIntercept)
| |
| validateCovarianceData | back to summary |
|---|---|
| protected void validateCovarianceData(double[][] x, double[][] covariance) Validates that the x data and covariance matrix have the same number of rows and that the covariance matrix is square.
| |
| validateSampleData | back to summary |
|---|---|
| protected void validateSampleData(double[][] x, double[] y) throws MathIllegalArgumentException Validates sample data. Checks that
| |