From 15dc632570da62255e1148357f01aaae581db57f Mon Sep 17 00:00:00 2001 From: chartl Date: Mon, 23 May 2011 14:15:36 +0000 Subject: [PATCH] The U-value can be zero (edge case) z-value can not be NaN (and can't possibly be null) git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5847 348d0f76-0448-11de-a6fe-93d51630548a --- java/src/org/broadinstitute/sting/utils/MannWhitneyU.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/src/org/broadinstitute/sting/utils/MannWhitneyU.java b/java/src/org/broadinstitute/sting/utils/MannWhitneyU.java index d8e42a98f..aab8a4c35 100755 --- a/java/src/org/broadinstitute/sting/utils/MannWhitneyU.java +++ b/java/src/org/broadinstitute/sting/utils/MannWhitneyU.java @@ -161,7 +161,7 @@ public class MannWhitneyU { * @return the asymptotic z-approximation corresponding to the MWU p-value for n < m */ @Requires({"m > 0","n > 0"}) - @Ensures({"result != null", "! Double.isInfinite(result)"}) + @Ensures({"! Double.isNaN(result)", "! Double.isInfinite(result)"}) private static double getZApprox(int n, int m, long u) { double mean = ( ((long)m)*n+1.0)/2; double var = (((long) n)*m*(n+m+1.0))/12; @@ -253,10 +253,10 @@ public class MannWhitneyU { * the other U-set. Note that if S1 dominates S2, we want to count the occurrences of points in S2 coming before points in S1. * @param observed - the observed data points, tagged by each set * @param dominator - the set that is hypothesized to be stochastically dominating - * @return the u-statistic associated with the hypothesis + * @return the u-statistic associated with the hypothesis that dominator stochastically dominates the other set */ @Requires({"observed != null","dominator != null","observed.size() > 0","validateObservations(observed)"}) - @Ensures({"return > 0"}) + @Ensures({"result >= 0"}) public static long calculateOneSidedU(TreeSet> observed,USet dominator) { long otherBeforeDominator = 0l; int otherSeenSoFar = 0;