BenjaminiHochberg implements MultipleTestingCorrection { @Override public void adjustPvals(List<? extends PValue> pvals) { Collections.sort(pvals); int N=pvals.size(); for (int r=0;r<N;r++) { PValue item = pvals.get(r); double raw_p = item.getRawPValue(); item.setAdjustedPValue(raw_p * N/(r+1)); } enforcePValueMonotony(pvals); }  @Override void adjustPvals(List<? extends PValue> pvals); @Override String getName();  }
@Test void testA() { MultipleTestingCorrection bonf = new BenjaminiHochberg(); bonf.adjustPvals(pvallist); PValue item = getResult(MadeUpPValues.A,pvallist); assertNotNull(item); double adjpval = item.getAdjustedPValue(); assertEquals(0.00150000,adjpval,EPSILON); }
@Test void testB() { MultipleTestingCorrection bonf = new BenjaminiHochberg(); bonf.adjustPvals(pvallist); double adjustedPValue = pvallist.get(1).getAdjustedPValue(); assertEquals(0.00300000,adjustedPValue,EPSILON); }
@Test void testC() { MultipleTestingCorrection bonf = new BenjaminiHochberg(); bonf.adjustPvals(pvallist); double adjustedPValue = pvallist.get(2).getAdjustedPValue(); assertEquals(0.00950000,adjustedPValue,EPSILON); }