Class CorrelationMatrix
- java.lang.Object
-
- dev.nm.algebra.linear.matrix.doubles.matrixtype.dense.DenseMatrix
-
- dev.nm.stat.descriptive.correlation.CorrelationMatrix
-
- All Implemented Interfaces:
Matrix
,MatrixAccess
,MatrixRing
,MatrixTable
,Densifiable
,AbelianGroup<Matrix>
,Monoid<Matrix>
,Ring<Matrix>
,Table
,DeepCopyable
public class CorrelationMatrix extends DenseMatrix
The correlation matrix of n random variables X1, ..., Xn is the n × n matrix whose i,j entry is corr(Xi, Xj), the correlation between X1 and Xn.- See Also:
- Wikipedia: Correlation matrices
-
-
Constructor Summary
Constructors Constructor Description CorrelationMatrix(Matrix cov)
Construct a correlation matrix from a covariance matrix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector
stdev()
Gets the standard deviations of the elements.double
stdev(int i)
Gets the standard deviation of the i-th element.Vector
var()
Gets the variance of the elements.double
var(int i)
Gets the variance of the i-th element.-
Methods inherited from class dev.nm.algebra.linear.matrix.doubles.matrixtype.dense.DenseMatrix
add, deepCopy, equals, get, getColumn, getColumn, getRow, getRow, hashCode, minus, multiply, multiply, nCols, nRows, ONE, opposite, scaled, set, setColumn, setRow, t, toDense, toString, ZERO
-
-
-
-
Constructor Detail
-
CorrelationMatrix
public CorrelationMatrix(Matrix cov)
Construct a correlation matrix from a covariance matrix.- Parameters:
cov
- a covariance matrix
-
-
Method Detail
-
var
public Vector var()
Gets the variance of the elements.- Returns:
- the variance of the elements
-
stdev
public Vector stdev()
Gets the standard deviations of the elements.- Returns:
- the standard deviations of the elements
-
var
public double var(int i)
Gets the variance of the i-th element.- Parameters:
i
- the index, counting from 1- Returns:
- the variance of the i-th element
-
stdev
public double stdev(int i)
Gets the standard deviation of the i-th element.- Parameters:
i
- the index, counting from 1- Returns:
- the standard deviation of the i-th element
-
-