The constructors that take RealMatrix or
double[][] arguments generate covariance matrices. The
columns of the input matrices are assumed to represent variable values.
The constructor argument biasCorrected determines whether or
not computed covariances are bias-corrected.
Unbiased covariances are given by the formula
cov(X, Y) = Σ[(xi - E(X))(yi - E(Y))] / (n - 1)
where E(X) is the mean of X and E(Y)
is the mean of the Y values.
Non-bias-corrected estimates use n in place of n - 1
| Modifier and Type | Field and Description |
|---|---|
| private final RealMatrix | covarianceMatrix
covariance matrix |
| private final int | n
Number of observations (length of covariate vectors) |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Covariance(double[][]
rectangular array with columns representing covariates data, boolean true means covariances are bias-corrected biasCorrected)Create a Covariance matrix from a rectangular array whose columns represent covariates. |
| public | Covariance(double[][]
rectangular array with columns representing covariates data)Create a Covariance matrix from a rectangular array whose columns represent covariates. |
| public | Covariance(RealMatrix
matrix with columns representing covariates matrix, boolean true means covariances are bias-corrected biasCorrected)Create a covariance matrix from a matrix whose columns represent covariates. |
| public | Covariance(RealMatrix
matrix with columns representing covariates matrix)Create a covariance matrix from a matrix whose columns represent covariates. |
| Modifier and Type | Method and Description |
|---|---|
| private void | checkSufficientData(final RealMatrix
matrix to check matrix)Throws MathIllegalArgumentException if the matrix does not have at least one column and two rows. |
| protected RealMatrix | Returns: covariance matrixinput matrix (must have at least one column and two rows) matrix, boolean determines whether or not covariance estimates are bias-corrected biasCorrected)Compute a covariance matrix from a matrix whose columns represent covariates. |
| protected RealMatrix | Returns: covariance matrixinput matrix (must have at least one column and two rows) matrix)Create a covariance matrix from a matrix whose columns represent covariates. |
| protected RealMatrix | Returns: covariance matrixinput array (must have at least one column and two rows) data, boolean determines whether or not covariance estimates are bias-corrected biasCorrected)Compute a covariance matrix from a rectangular array whose columns represent covariates. |
| protected RealMatrix | Returns: covariance matrixinput array (must have at least one column and two rows) data)Create a covariance matrix from a rectangular array whose columns represent covariates. |
| public double | Returns: returns the covariance for the two arraysfirst data array xArray, final double[] second data array yArray, boolean if true, returned value will be bias-corrected biasCorrected)Computes the covariance between the two arrays. |
| public double | Returns: returns the covariance for the two arraysfirst data array xArray, final double[] second data array yArray)Computes the covariance between the two arrays, using the bias-corrected formula. |
| public RealMatrix | |
| public int | Returns: number of observationsReturns the number of observations (length of covariate vectors) |
| covarianceMatrix | back to summary |
|---|---|
| private final RealMatrix covarianceMatrix covariance matrix | |
| n | back to summary |
|---|---|
| private final int n Number of observations (length of covariate vectors) | |
| Covariance | back to summary |
|---|---|
| public Covariance() Create a Covariance with no data | |
| Covariance | back to summary |
|---|---|
| public Covariance(double[][] data, boolean biasCorrected) throws MathIllegalArgumentException, NotStrictlyPositiveException Create a Covariance matrix from a rectangular array whose columns represent covariates. The The input array must be rectangular with at least one column and two rows.
| |
| Covariance | back to summary |
|---|---|
| public Covariance(double[][] data) throws MathIllegalArgumentException, NotStrictlyPositiveException Create a Covariance matrix from a rectangular array whose columns represent covariates. The input array must be rectangular with at least one column and two rows
| |
| Covariance | back to summary |
|---|---|
| public Covariance(RealMatrix matrix, boolean biasCorrected) throws MathIllegalArgumentException Create a covariance matrix from a matrix whose columns represent covariates. The The matrix must have at least one column and two rows
| |
| Covariance | back to summary |
|---|---|
| public Covariance(RealMatrix matrix) throws MathIllegalArgumentException Create a covariance matrix from a matrix whose columns represent covariates. The matrix must have at least one column and two rows
| |
| checkSufficientData | back to summary |
|---|---|
| private void checkSufficientData(final RealMatrix matrix) throws MathIllegalArgumentException Throws MathIllegalArgumentException if the matrix does not have at least one column and two rows.
| |
| computeCovarianceMatrix | back to summary |
|---|---|
| protected RealMatrix computeCovarianceMatrix(RealMatrix matrix, boolean biasCorrected) throws MathIllegalArgumentException Compute a covariance matrix from a matrix whose columns represent covariates.
| |
| computeCovarianceMatrix | back to summary |
|---|---|
| protected RealMatrix computeCovarianceMatrix(RealMatrix matrix) throws MathIllegalArgumentException Create a covariance matrix from a matrix whose columns represent covariates. Covariances are computed using the bias-corrected formula.
| |
| computeCovarianceMatrix | back to summary |
|---|---|
| protected RealMatrix computeCovarianceMatrix(double[][] data, boolean biasCorrected) throws MathIllegalArgumentException, NotStrictlyPositiveException Compute a covariance matrix from a rectangular array whose columns represent covariates.
| |
| computeCovarianceMatrix | back to summary |
|---|---|
| protected RealMatrix computeCovarianceMatrix(double[][] data) throws MathIllegalArgumentException, NotStrictlyPositiveException Create a covariance matrix from a rectangular array whose columns represent covariates. Covariances are computed using the bias-corrected formula.
| |
| covariance | back to summary |
|---|---|
| public double covariance(final double[] xArray, final double[] yArray, boolean biasCorrected) throws MathIllegalArgumentException Computes the covariance between the two arrays. Array lengths must match and the common length must be at least 2.
| |
| covariance | back to summary |
|---|---|
| public double covariance(final double[] xArray, final double[] yArray) throws MathIllegalArgumentException Computes the covariance between the two arrays, using the bias-corrected formula. Array lengths must match and the common length must be at least 2.
| |
| getCovarianceMatrix | back to summary |
|---|---|
| public RealMatrix getCovarianceMatrix() Returns the covariance matrix
| |
| getN | back to summary |
|---|---|
| public int getN() Returns the number of observations (length of covariate vectors)
| |