|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpapaya.Comparison
public class Comparison
Contains a number of methods for comparing more than one dataset against each other. Rank-based methods and are powerful in the sense that they do not rely on the data assuming a normal distribution.
Nested Class Summary | |
---|---|
static class |
Comparison.TTest
Methods related to comparing two populations. |
Field Summary |
---|
Fields inherited from interface papaya.PapayaConstants |
---|
BASELINE, big, biginv, BOTTOM, CENTER, CORNER, FONTNAME, GRAY, INDEX_NOT_FOUND, INDICES_NOT_FOUND, LEFT, LOGPI, MACHEP, MAXGAM, MAXLOG, MINLOG, RIGHT, SQRTH, SQTPI, STROKEWEIGHT, TEXTSIZE, TOP |
Constructor Summary | |
---|---|
Comparison()
Makes this class non instantiable, but still let's others inherit from it. |
Method Summary | |
---|---|
static float[] |
mannWhitney(float[] data1,
float[] data2)
Computes and returns the MannWhitney (or Wilcoxon Rank Sum) test statistic, U and p-value for
assessing whether one of two samples of independent observations tends to have
larger values than the other. |
static float |
signTest(float[] x,
float[] y)
Performs the sign test on an input array and returns the test statistic used to test the hypothesis that there is "no difference in medians" between the continuous distributions of two random variables X and Y. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Comparison()
Method Detail |
---|
public static float[] mannWhitney(float[] data1, float[] data2)
U
and p-value for
assessing whether one of two samples of independent observations tends to have
larger values than the other. That is,
U = min(U1,U2)where
U1 = Sum(Ranks1) - n1*(n1+1)/2, U2 = Sum(Ranks2) - n2*(n2+1)/2.and the significance, or p-value is computed assuming a two-tailed null-hypothesis that both samples are similar.
data1
- the first datasetdata2
- the second dataset
IllegalArgumentException
- if either of the sample sizes is less than 8 (the normal approximation
is no longer valid in that case. Best to consult a table instead).public static float signTest(float[] x, float[] y)
To elaborate, the null hypothesis H0 states that given a random pair of measurements (X[i], Y[i]),
X[i] and Y[i] are equally likely to be larger than the other.
Now, let n
be the number of pairs for which Y[i] ≠ X[i] and w
be the number of pairs for which Y[i] - X[i] > 0.
Assuming that H0 is true, then W follows a binomial distribution W ~ b(n, 0.5).
This method returns the sum of the terms 0
through w
of the Binomial
probability density.
Sum_(j=0 to w) [ (n!)/(j!*(n-j)! ] * [ p^j * (1-p)^(n-j) ] from 0 to the test-statistic, orp = Probability.binomcdf(.5,w,n).
For n > 100, the normal distribution cdf is returned instead. If this is less than the critical value, then we can reject the null hypothesis that there is no difference between the samples X and Y.
x
- data set containing 1st observation sequencey
- data set containing 2nd observation sequence
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |