@Test public void testPPMCCMulti() { double[][] data = new double[][] { new double[] { 2, 3, 4, 5, 6 }, new double[] { 2.2, 33.2, 44.4, 55.5, 66.6 }, new double[] { 2, 3, 4, 5, 6 } }; PearsonsCorrelation corr = new PearsonsCorrelation(); double[] ppmcc = MathUtils.ppmcc(data, 0); for (int i = 0; i < data.length; i++) { double correlation = corr.correlation(data[0], data[i]); assertEquals(ppmcc[i], correlation, 0.001); } }
public static double ppmcc(double[] a, double[] b) { double amean = MathUtils.mean(a); double aStdDev = MathUtils.standardDeviation(a, amean); double bmean = MathUtils.mean(b); double bStdDev = MathUtils.standardDeviation(b, bmean); double cor = (MathUtils.covariance(a, aStdDev, b, bmean)) / (aStdDev * bStdDev); return cor; }
MathUtils { public static double ppmcc(double[] a, double[] b) { double amean = MathUtils.mean(a); double aStdDev = MathUtils.standardDeviation(a, amean); double bmean = MathUtils.mean(b); double bStdDev = MathUtils.standardDeviation(b, bmean); double cor = (MathUtils.covariance(a, aStdDev, b, bmean)) / (aStdDev * bStdDev); return cor; } }
MathUtils { public static double ppmcc(double[] a, double[] b) { double amean = MathUtils.mean(a); double aStdDev = MathUtils.standardDeviation(a, amean); double bmean = MathUtils.mean(b); double bStdDev = MathUtils.standardDeviation(b, bmean); double cor = (MathUtils.covariance(a, aStdDev, b, bmean)) / (aStdDev * bStdDev); return cor; }  }
MathUtils { public static double ppmcc(double[] a, double[] b) { double amean = MathUtils.mean(a); double aStdDev = MathUtils.standardDeviation(a, amean); double bmean = MathUtils.mean(b); double bStdDev = MathUtils.standardDeviation(b, bmean); double cor = (MathUtils.covariance(a, aStdDev, b, bmean)) / (aStdDev * bStdDev); return cor; }  static double ppmcc(double[] a, double[] b); static double mean(double[] a); static long mean(long[] a); static double covariance(double[] a, double amean, double[] b, double bmean); static long standardDeviation(long[] a, long avg); static double standardDeviation(double[] a, double avg); static double[] ppmcc(double[][] ary, int baseIndex); }
MathUtils { public static double ppmcc(double[] a, double[] b) { double amean = MathUtils.mean(a); double aStdDev = MathUtils.standardDeviation(a, amean); double bmean = MathUtils.mean(b); double bStdDev = MathUtils.standardDeviation(b, bmean); double cor = (MathUtils.covariance(a, aStdDev, b, bmean)) / (aStdDev * bStdDev); return cor; }  static double ppmcc(double[] a, double[] b); static double mean(double[] a); static long mean(long[] a); static double covariance(double[] a, double amean, double[] b, double bmean); static long standardDeviation(long[] a, long avg); static double standardDeviation(double[] a, double avg); static double[] ppmcc(double[][] ary, int baseIndex);  }