import javastat.inference.OneWayANOVA;

 

/**

 *

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

 * <p>Data Source: Anderson, D. R., Sweeney, D. J. and Williams, T. A. (2001).

 *    Contemporary Business Statistics with Microsoft Excel. South-Western,

 * p. 408. </p>

 */

 

double[][] anovadata = { {6.0, 7.0, 6.0, 8.0}, {8.0, 9.0, 8.0, 10.0},

                     {13.0, 14.0, 15.0} };

 

testclass1 = new OneWayANOVA(anovadata);

testStatistic = testclass1.testStatistic;

pValue = testclass1.pValue;

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

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

 

testclass2 = new OneWayANOVA();

testStatistic = testclass2.testStatistic(anovadata);

pValue = testclass2.pValue(anovadata);

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

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

 

Results:

The test statistic based on non-null constructor    = 49.721

The p-value based on non-null constructor        = 3.073E-5

The test statistic based on null constructor        = 49.7219

The p-value based on null constructor            = 3.073E-5

 

See also:

An Introduction to Analysis of Variance