/** * Computes the significance of the difference between two correlations. * @see org.tud.sir.util.statistics.Significance.testCorrelations */ public static double getSignificance(double correlation1, double correlation2, int n1, int n2) throws MathException { // transform to Fisher Z-values double zv1 = getZValue(correlation1); double zv2 = getZValue(correlation2); // difference of the Z-values double zDifference = (zv1 - zv2) / Math.sqrt( (double)1/(n1-3) + (double)1/(n2-3)); // get p value from the normal distribution NormalDistribution normal = new NormalDistributionImpl(); double p = 2 * (1 - normal.cumulativeProbability( Math.abs(zDifference))); return p; }