package examples.javastat;

 

import javastat.inference.nonparametric.RankSumTest;

 

/**

 *

 * <p>Example: class RankSumTest.</p>

 * <p>Data Source: Hollander, M. and Wolfe, D. A. (1999).

 *    Nonparametric Statistical Methods. John Wiley and Sons, INC., p. 110. </p>

 */

 

double[] testdata1 = {1.15, 0.88, 0.9, 0.74, 1.21};

double[] testdata2 = {0.8, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46};

testclass1 = new RankSumTest(0.05, "equal", testdata1, testdata2);

wAlpha = testclass1.wAlpha;

testStatistic = testclass1.testStatistic;

pValue = testclass1.pValue;

print("The test statistic (non-null constructor)         =  " + testStatistic);

print("The p-value (non-null constructor)             =  " + pValue);

 

testclass2 = new RankSumTest();

testStatistic = testclass2.testStatistic(testdata1, testdata2);

wAlpha = testclass2.wAlpha(0.05, testdata1, testdata2);

pValue = testclass2.pValue("equal", testdata1, testdata2);

print("The test statistic (null constructor)             =  " + testStatistic);

print("The p-value (null constructor)                 =  " + pValue);

 

Results:

The test statistic based on non-null constructor                   = 30.0

The p-value based on non-null constructor                       = 0.254

The test statistic based on null constructor                       = 30.0

The p-value based on null constructor                           = 0.254