I want to calculate covariance matrix using Java.
Is there any free library to compute covariance Matrix in Java?
Covariance Matrix is a measure of how much two random variables gets change together. It is actually used for computing the covariance in between every column of data matrix. The Covariance Matrix is also known as dispersion matrix and variance-covariance matrix.
Here is a short example, how you can create it with Apache Commons Math (3.5):
RealMatrix mx = MatrixUtils.createRealMatrix(new double[][]{
{1, 2, 3},
{2, 4, 6}
});
RealMatrix cov = new Covariance(mx).getCovarianceMatrix();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With