import javastat.inference.nonparametric.SignRankTest;
/**
*
* <p>Example: class SignRankTest.</p>
* <p>Data Source: Hollander, M. and
Wolfe, D. A. (1999).
* Nonparametric Statistical
Methods. John Wiley and Sons, INC., p. 41. </p>
*/
double[] testdata1 = {750, 1400, -300, 2400, -700, 800, 1300, -400,
1900, -1100, 1600, 300};
testclass1
= new SignRankTest(testdata1);
tAlpha = testclass1.tAlpha;
testStatistic =
testclass1.testStatistic;
pValue = testclass1.pValue;
print("The test statistic (non-null constructor) = " + testStatistic);
print("The p-value (non-null constructor)
= " + pValue);
testclass2
= new SignRankTest();
testStatistic =
testclass2.testStatistic(0, testdata1);
tAlpha = testclass2.tAlpha(0.05, 0, testdata1);
pValue = testclass2.pValue(0, "greater",
testdata1);
print("The test statistic (null constructor)
= " + testStatistic);
print("The p-value (null constructor)
= " + pValue);
Results:
The
test statistic based on non-null constructor
= 62.5
The
p-value based on non-null constructor
= 0.078
The
test statistic based on null constructor
= 62.5
The
p-value based on null constructor
= 0.039