drasys.or.stat.model
Class GeneralLinearModel
java.lang.Object
|
+--drasys.or.stat.model.GeneralLinearModel
- public class GeneralLinearModel
- extends java.lang.Object
- implements GeneralLinearModelI
An implementation of the general linear model.
References:
Applied Linear Statistical Models (Irwin Series in Statistics)
Michael H. Kutner, et al / Hardcover / Published 1996
Numerical Recipes in C : The Art of Scientific Computing
William H. Press, et al / Hardcover / Published 1993
Method Summary |
VectorI |
getCoefficients()
Returns the solution coefficients. |
VectorI |
getDependent()
Returns the dependent vector. |
int |
getDFE()
Returns the number of degrees of freedom for the errors. |
int |
getDFR()
Returns the number of degrees of freedom for the regression. |
int |
getDFT()
Returns the total number of degrees. |
MatrixI |
getIndependent()
Returns the independent matrix. |
MatrixI |
getInverseXX()
Returns the X'X inverse matrix. |
double |
getMSE()
Returns the mean of the squares of the error terms. |
double |
getMSR()
Returns the mean of the squares of the computed dependent values. |
double |
getMST()
Returns the mean of the squares of the sampled dependent values. |
double |
getRSquared()
Returns R^2. |
double |
getSSE()
Returns the sum of the squares of the error terms. |
double |
getSSR()
Returns the sum of the squares of the computed dependent values. |
double |
getSST()
Returns the sum of the squares of the sampled dependent values. |
VectorI |
getStandardErrors()
Returns the standard errors of the fitted independent variables. |
VectorI |
solve()
Solve for the fitting coefficients using all of the independent variables. |
VectorI |
solve(boolean forceZeroIntercept)
Solve for the fitting coefficients using all of the independent variables. |
VectorI |
solve(boolean forceZeroIntercept,
int[] columnSelection)
Solve for the coefficients using only the dependent columns listed in 'columnSelection'. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
GeneralLinearModel
public GeneralLinearModel(VectorI dependent,
MatrixI independent)
- Initialize the model with the variables.
getRSquared
public double getRSquared()
- Returns R^2.
R^2 = ModelSumOfSquares()/TotalSumOfSquares();
- Specified by:
- getRSquared in interface GeneralLinearModelI
getSST
public double getSST()
- Returns the sum of the squares of the sampled dependent values.
SST = SSR + SSE.
- Specified by:
- getSST in interface GeneralLinearModelI
getSSE
public double getSSE()
- Returns the sum of the squares of the error terms.
The error terms are the differences between the sampled and computed dependent values.
SST = SSR + SSE.
- Specified by:
- getSSE in interface GeneralLinearModelI
getSSR
public double getSSR()
- Returns the sum of the squares of the computed dependent values.
SST = SSR + SSE.
- Specified by:
- getSSR in interface GeneralLinearModelI
getDFR
public int getDFR()
- Returns the number of degrees of freedom for the regression.
- Specified by:
- getDFR in interface GeneralLinearModelI
getDFE
public int getDFE()
- Returns the number of degrees of freedom for the errors.
- Specified by:
- getDFE in interface GeneralLinearModelI
getDFT
public int getDFT()
- Returns the total number of degrees.
- Specified by:
- getDFT in interface GeneralLinearModelI
getMST
public double getMST()
- Returns the mean of the squares of the sampled dependent values.
MST = SST/DFT.
- Specified by:
- getMST in interface GeneralLinearModelI
getMSE
public double getMSE()
- Returns the mean of the squares of the error terms.
The error terms are the differences between the sampled and computed dependent values.
MSE = SSE/DFE.
- Specified by:
- getMSE in interface GeneralLinearModelI
getMSR
public double getMSR()
- Returns the mean of the squares of the computed dependent values.
MSR = SSR/DFR.
- Specified by:
- getMSR in interface GeneralLinearModelI
solve
public VectorI solve()
- Solve for the fitting coefficients using all of the independent variables.
This is equivalent to 'columnSelection' = {0,1,2,...}.
The fitting line is allowed to cross the dependent axis away from the origin.
and the intercept term will be the last value in the solution vector.
- Specified by:
- solve in interface GeneralLinearModelI
solve
public VectorI solve(boolean forceZeroIntercept)
- Solve for the fitting coefficients using all of the independent variables.
This is equivalent to 'columnSelection' = {0,1,2,...}.
If 'forceZeroIntercept' is true, the fitted line will be forced to cross the dependent axis at the origin
and the intercept value will NOT appear at the end of the solution vector.
Otherwise;
The fitting line is allowed to cross the dependent axis away from the origin.
and the intercept term will be the last value in the solution vector.
- Specified by:
- solve in interface GeneralLinearModelI
solve
public VectorI solve(boolean forceZeroIntercept,
int[] columnSelection)
- Solve for the coefficients using only the dependent columns listed in 'columnSelection'.
The resluting coefficients will be ordered to match 'columnSelection'.
If 'forceZeroIntercept' is true, the fitted line will be forced to cross the dependent axis at the origin
and the intercept value will NOT appear at the end of the solution vector.
Otherwise;
The fitting line is allowed to cross the dependent axis away from the origin.
and the intercept term will be the last value in the solution vector.
- Specified by:
- solve in interface GeneralLinearModelI
getDependent
public VectorI getDependent()
- Returns the dependent vector.
- Specified by:
- getDependent in interface GeneralLinearModelI
getIndependent
public MatrixI getIndependent()
- Returns the independent matrix.
- Specified by:
- getIndependent in interface GeneralLinearModelI
getCoefficients
public VectorI getCoefficients()
- Returns the solution coefficients.
The coefficient at index 'n' corresponds to the column indexed by 'columnSelection[n]'.
If a constant intercept term is included, its value will be in the last element.
- Specified by:
- getCoefficients in interface GeneralLinearModelI
getStandardErrors
public VectorI getStandardErrors()
- Returns the standard errors of the fitted independent variables.
If a constant intercept term is included, its standard error will be in the last element.
- Specified by:
- getStandardErrors in interface GeneralLinearModelI
getInverseXX
public MatrixI getInverseXX()
- Returns the X'X inverse matrix.
If a constant intercept term is included, it will occupy the last row and column.
- Specified by:
- getInverseXX in interface GeneralLinearModelI
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object
Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com