|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMannWhitneyU
public class MannWhitneyU
MannWhitneyU - a Java utility to perform a Mann-Whitney U test on a table of data
The Mann-Whitney U test is a non-parametric statistical test used to assess the difference between two independent samples, which is to say, between two conditions assigned between-subjects. The relationship with other non-parametric tests is illustrated below:
The test operates on ordinal data, such as rankings or questionnaire responses (where the responses are non-linear). Interval or ratio-scale data can be used, however the Mann-Whitney U test (and other non-parametric tests) pre-process the data into ranks. If the researcher believes the ANOVA assumptions of normality and homogeneity of variances are violated to the extent that the ANOVA is inappropriate as a test instrument, then a non-parametric test is a reasonable alternative. However, as Sheskin notes, "when a researcher elects to transform a set of interval/ratio data into ranks, information is sacrificed" (Sheskin, 1996, p. 423). A simple and obvious example is the transformation of student marks A = 49, B = 79, and C = 80, into ranks 1, 2, and 3. Yes, something is sacrificed. Others have noted that the parametric ANOVA is robust and relatively unperturbed by violations in its assumptions (e.g., Lowry, Subchapter 14a in "Concepts and Applications of Inferential Statistics"; http://vassarstats.net/textbook/index.html). So, the choice of a non-parametric test, such as the Mann-Whitney U, should not be taken lightly if the data are ratio scale or interval scale.
Invocation (usage message if invoked without arguments):
Example. Consider an experiment seeking to determine if there is a difference in the
political leaning of MAC users vs. PC users. Are MAC or PC users more likely to have political
views leaning to the "left" or "right"? The experimenter randomly selects 10 MAC users and 10 PC
users. The participants are interviewed and asked a variety of questions about their political
leaning. Each participant is assessed on a 10-point linear scale (1 = very left, 10 = very right)
with the results stored in a text file as a matrix with two columns. The first column contains
the assessments for the MAC users, the second column for the PC users (see mannwhitneyu-ex1.txt). The data are then processed by the
MannWhitneyU
utility. For example,
For convenience, the test statistic U is converted to a z-score. This facilitates computing p. Since the customary threshold for statistical significance (p < .05) was not exceeded, the null hypothesis remains tenable, inferring a likelihood that the two samples are from the same population. We conclude there is no difference between the political leaning of MAC users and PC users.
The test also provides z' which is corrected for ties. The difference is usually minor.
StatView provides the following output using the data above:
Missing data. Since the design is between-subjects, it is sometimes difficult to have equal-size groups. For example, if two of the MAC participants do not show up for the interview, then there will be 8 participants in the MAC group and 10 participants in the PC group. This is accommodated by using periods (".") for missing data (see mannwhitneyu-ex2.txt). For example,
The conclusion is the same. Note that "equal sample sizes" is one assumption of the parametric ANOVA that, if violated, justifies using a non-parametric test, such as the Mann-Whitney U (see Lowry reference, cited above).
Constructor Summary | |
---|---|
MannWhitneyU(double[][] dataArg,
boolean vOption)
|
Method Summary | |
---|---|
double |
getP1()
|
double |
getP2()
|
double[] |
getRanks(double[] d)
|
double |
getU()
|
double |
getZ1()
|
double |
getZ2()
|
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MannWhitneyU(double[][] dataArg, boolean vOption)
Method Detail |
---|
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
public double getU()
public double getZ1()
public double getZ2()
public double getP1()
public double getP2()
public double[] getRanks(double[] d)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |