public class LeastSquaresFit extends Object
Data with missing values is handled but is less memory efficient and somewhat slower. The main cost is that when there are no missing values, a single QR decomposition can be performed.
Constructor and Description |
---|
LeastSquaresFit(DesignMatrix designMatrix,
DoubleMatrix<String,String> data)
Preferred interface if you want control over how the design is set up.
|
LeastSquaresFit(DesignMatrix designMatrix,
DoubleMatrix<String,String> data,
cern.colt.matrix.DoubleMatrix2D weights)
Weighted least squares fit between two matrices
|
LeastSquaresFit(DesignMatrix designMatrix,
cern.colt.matrix.DoubleMatrix2D b,
cern.colt.matrix.DoubleMatrix2D weights)
Preferred interface for weighted least squares fit between two matrices
|
LeastSquaresFit(cern.colt.matrix.DoubleMatrix1D vectorA,
cern.colt.matrix.DoubleMatrix1D vectorB)
Least squares fit between two vectors.
|
LeastSquaresFit(cern.colt.matrix.DoubleMatrix1D vectorA,
cern.colt.matrix.DoubleMatrix1D vectorB,
cern.colt.matrix.DoubleMatrix1D weights)
Stripped-down interface for simple use.
|
LeastSquaresFit(cern.colt.matrix.DoubleMatrix2D A,
cern.colt.matrix.DoubleMatrix2D b)
ANOVA not possible (use the other constructors)
|
LeastSquaresFit(cern.colt.matrix.DoubleMatrix2D A,
cern.colt.matrix.DoubleMatrix2D b,
cern.colt.matrix.DoubleMatrix2D weights)
Weighted least squares fit between two matrices
|
LeastSquaresFit(ObjectMatrix<String,String,Object> sampleInfo,
cern.colt.matrix.impl.DenseDoubleMatrix2D data) |
LeastSquaresFit(ObjectMatrix<String,String,Object> sampleInfo,
cern.colt.matrix.impl.DenseDoubleMatrix2D data,
boolean interactions) |
LeastSquaresFit(ObjectMatrix<String,String,Object> design,
DoubleMatrix<String,String> b)
NamedMatrix allows easier handling of the results.
|
LeastSquaresFit(ObjectMatrix<String,String,Object> design,
DoubleMatrix<String,String> data,
boolean interactions)
NamedMatrix allows easier handling of the results.
|
Modifier and Type | Method and Description |
---|---|
protected List<GenericAnovaResult> |
anova()
Compute ANOVA based on the model fit (Type I SSQ, sequential)
The idea is to add up the sums of squares (and dof) for all parameters associated with a particular factor.
|
protected void |
ebayesUpdate(double d,
double v,
cern.colt.matrix.DoubleMatrix1D vp)
Provide results of limma eBayes algorithm.
|
cern.colt.matrix.DoubleMatrix2D |
getCoefficients()
The matrix of coefficients x for Ax = b (parameter estimates).
|
double |
getDfPrior() |
cern.colt.matrix.DoubleMatrix2D |
getFitted() |
int |
getResidualDof() |
List<Integer> |
getResidualDofs() |
cern.colt.matrix.DoubleMatrix2D |
getResiduals() |
cern.colt.matrix.DoubleMatrix2D |
getStudentizedResiduals() |
cern.colt.matrix.DoubleMatrix1D |
getVarPost() |
double |
getVarPrior() |
cern.colt.matrix.DoubleMatrix2D |
getWeights() |
boolean |
isHasBeenShrunken() |
boolean |
isHasMissing() |
List<LinearModelSummary> |
summarize() |
List<LinearModelSummary> |
summarize(boolean anova) |
protected LinearModelSummary |
summarize(int i)
Compute and organize the various summary statistics for a fit.
|
Map<String,LinearModelSummary> |
summarizeByKeys(boolean anova) |
public LeastSquaresFit(DesignMatrix designMatrix, DoubleMatrix<String,String> data)
designMatrix
- data
- public LeastSquaresFit(DesignMatrix designMatrix, DoubleMatrix<String,String> data, cern.colt.matrix.DoubleMatrix2D weights)
designMatrix
- data
- weights
- to be used in modifying the influence of the observations in data.public LeastSquaresFit(DesignMatrix designMatrix, cern.colt.matrix.DoubleMatrix2D b, cern.colt.matrix.DoubleMatrix2D weights)
designMatrix
- b
- the dataweights
- to be used in modifying the influence of the observations in vectorB.public LeastSquaresFit(cern.colt.matrix.DoubleMatrix1D vectorA, cern.colt.matrix.DoubleMatrix1D vectorB)
vectorA
- DesignvectorB
- Datapublic LeastSquaresFit(cern.colt.matrix.DoubleMatrix1D vectorA, cern.colt.matrix.DoubleMatrix1D vectorB, cern.colt.matrix.DoubleMatrix1D weights)
vectorA
- DesignvectorB
- Dataweights
- to be used in modifying the influence of the observations in vectorB.public LeastSquaresFit(cern.colt.matrix.DoubleMatrix2D A, cern.colt.matrix.DoubleMatrix2D b)
A
- Design matrix, which will be used directly in least squares regressionb
- Data matrix, containing data in rows.public LeastSquaresFit(cern.colt.matrix.DoubleMatrix2D A, cern.colt.matrix.DoubleMatrix2D b, cern.colt.matrix.DoubleMatrix2D weights)
A
- Designb
- Dataweights
- to be used in modifying the influence of the observations in b. If null, will be ignored.public LeastSquaresFit(ObjectMatrix<String,String,Object> sampleInfo, cern.colt.matrix.impl.DenseDoubleMatrix2D data)
sampleInfo
- information that will be converted to a design matrix; intercept term is added.data
- Data matrixpublic LeastSquaresFit(ObjectMatrix<String,String,Object> sampleInfo, cern.colt.matrix.impl.DenseDoubleMatrix2D data, boolean interactions)
sampleInfo
- data
- interactions
- add interaction term (two-way only is supported)public LeastSquaresFit(ObjectMatrix<String,String,Object> design, DoubleMatrix<String,String> b)
design
- information that will be converted to a design matrix; intercept term is added.b
- Data matrixpublic LeastSquaresFit(ObjectMatrix<String,String,Object> design, DoubleMatrix<String,String> data, boolean interactions)
design
- information that will be converted to a design matrix; intercept term is added.data
- Data matrixpublic cern.colt.matrix.DoubleMatrix2D getCoefficients()
public double getDfPrior()
public cern.colt.matrix.DoubleMatrix2D getFitted()
public int getResidualDof()
public cern.colt.matrix.DoubleMatrix2D getResiduals()
public cern.colt.matrix.DoubleMatrix2D getStudentizedResiduals()
public cern.colt.matrix.DoubleMatrix1D getVarPost()
public double getVarPrior()
public cern.colt.matrix.DoubleMatrix2D getWeights()
public boolean isHasBeenShrunken()
public boolean isHasMissing()
public List<LinearModelSummary> summarize()
public List<LinearModelSummary> summarize(boolean anova)
anova
- if true, ANOVA will be computedpublic Map<String,LinearModelSummary> summarizeByKeys(boolean anova)
anova
- perform ANOVA, otherwise only basic summarization will be done. If ebayesUpdate has been run,
variance and degrees of freedom
estimated using the limma eBayes algorithm will be used.protected List<GenericAnovaResult> anova()
The idea is to add up the sums of squares (and dof) for all parameters associated with a particular factor.
This code is more or less ported from R summary.aov.
protected void ebayesUpdate(double d, double v, cern.colt.matrix.DoubleMatrix1D vp)
d
- dfPriorv
- varPriorvp
- varPostprotected LinearModelSummary summarize(int i)
If ebayes has been run, variance and degrees of freedom estimated using the limma eBayes algorithm will be used.
Does not populate the ANOVA.
i
- index of the fit to summarizeCopyright © 2003–2022 UBC Michael Smith Laboratories. All rights reserved.