|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvec_math.generalLinearRegression
public abstract class generalLinearRegression
Abstract base class for all general linear least square fits. Provides methods to derive linear parameters out of the design matrix. Non-abstract subclasses must provide Matrix getBasicFunctions. Out of these the design Matrix is calculated via Aij = Xj(xi)/sig_i, with Xj(xi) the basic functions. Overriding the deriveDesignMatrix(Matrix basicfunction) and just setting the getBasicFunctions() to {} is perfectly legal, because only the design matrix is used in further calculations. The design matrix must have more rows than columns. The normal equations are defined via (A(T)A)a=A(T)b, where A is the design matrix, a is the solution vector and b is the measurement vector: yi/sig_i. The private method invertNormal() expects the design matrix to be set, and calculates the inverse of A(T)A. The diagonal elements of that matrix are the squared standard deviation of the solution vector, which in turn can be found by multiplying A(T)b with the inverse matrix. Lit: Num.Rec. p 671ff.
| Field Summary | |
|---|---|
double |
ChiSquare
|
Matrix |
Design
|
protected QuadMatrix |
Invert
|
double[] |
LinFit
|
Matrix |
Measure
|
double |
Q
|
double[] |
si
|
double[] |
SigFit
|
boolean |
validFit
|
protected boolean |
validInvert
|
boolean |
validSig
|
double[] |
yi
|
| Constructor Summary | |
|---|---|
generalLinearRegression()
|
|
| Method Summary | |
|---|---|
boolean |
deriveDesignMatrix()
|
boolean |
deriveDesignMatrix(Matrix base)
|
void |
deriveMeasure()
Sets the Measure Matrix out of yi,si and Design. |
abstract Matrix |
getBasicFunctions()
|
double |
getChiSquare()
Returns the chi square of the solution. |
double |
getQ()
Returns the 1-p(N-M/2,chi^2/2) value. |
double[] |
getSigma()
Returns the vector of the standard deviations of the linear fit parameters. |
double[] |
getSolution()
Returns the vector of the solving linear parameters that minimize chi^2 Sets the LinFit array and validFit. |
private void |
invertNormal()
Inverts the normal equations (A(T)A), therefore the design matrix must be valid. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public Matrix Design
public Matrix Measure
public double[] yi
public double[] si
protected QuadMatrix Invert
protected boolean validInvert
public double[] LinFit
public double[] SigFit
public boolean validFit
public boolean validSig
public double ChiSquare
public double Q
| Constructor Detail |
|---|
public generalLinearRegression()
| Method Detail |
|---|
public abstract Matrix getBasicFunctions()
public boolean deriveDesignMatrix()
public boolean deriveDesignMatrix(Matrix base)
base -
public void deriveMeasure()
private void invertNormal()
public double[] getSolution()
public double[] getSigma()
public double getChiSquare()
public double getQ()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||