package com.imsl.test.example.stat; import com.imsl.stat.PooledCovariances; import com.imsl.math.PrintMatrix; /** *
Computes a pooled variance-covariance matrix involving 2 groups.
* * @see Code * @see Output */ public class PooledCovariancesEx1 { static public void main(String arg[]) { double[][] x = { {2.2, 5.6}, {3.4, 2.3}, {1.2, 7.8}, {3.2, 2.1}, {4.1, 1.6}, {3.7, 2.2} }; int[] groups = {1, 1, 1, 2, 2, 2}; int nGroups = 2; PooledCovariances pc = new PooledCovariances(nGroups); pc.update(x, groups); double covar[][] = pc.getPooledCovariances(); new PrintMatrix("Pooled Covariances").print(covar); } }