### Question:
Statistics { public static double calculateSpearmanTwoTailedPvalue(double spearmanCorrelation, int sampleSize){ double z = Math.sqrt((sampleSize-3)/1.06) * atanh(spearmanCorrelation); NormalDistribution normalDistribution = new NormalDistribution(); double p = 2*normalDistribution.cumulativeProbability(-Math.abs(z)); if (Double.isNaN(z)){ p = 0; } if (Double.isNaN(spearmanCorrelation)){ p = 1; } return p; }  static double calculateSpearmanTwoTailedPvalue(double spearmanCorrelation, int sampleSize); static double anova(double sumOfSquaresModelA, double sumOfSquaresModelB, int degreesOfFreedomA,
			int degreesOfFreedomB, Boolean no_intercept);  }### Answer:
@Test public void calculateSpearmanTwoTailedPvalueTest() throws Exception { double expectedPval = 1.773084e-06; double observedPval = Statistics.calculateSpearmanTwoTailedPvalue(0.1504121, 1000); assertEquals(expectedPval,observedPval, 0.001); expectedPval = 1; observedPval = Statistics.calculateSpearmanTwoTailedPvalue(0, 1000); assertEquals(expectedPval,observedPval, 0.001); }
@Test public void calculateSpearmanTwoTailedPvalueNaNTest() throws Exception { double expectedPval = 0; double observedPval = Statistics.calculateSpearmanTwoTailedPvalue(1000000, 1000); assertEquals(expectedPval,observedPval, 0.001); }