import javastat.inference.twosamples.MatchedSampMeansTTest;

 

/**

 *

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

 */

 

double[] testdata1 = {51, 22, 17, 11, 28, 17, 5, 21, 22, 10};

double[] testdata2 = {32, 14, 9, 8, 28, 11, 3, 23, 12, 14};

 

testclass1 = new MatchedSampMeansTTest(0.05, 0, "equal", testdata1,

testdata2);

testStatistic = testclass1.testStatistic;

pValue = testclass1.pValue;

lowerBound = testclass1.confidenceInterval[0];

upperBound = testclass1.confidenceInterval[1];

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

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

print("The confidence interval (non-null constructor)   = [" +

     lowerBound + " , " + upperBound + "]");

 

testclass2 = new MatchedSampMeansTTest();

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

testStatistic = testclass2.testStatistic(0, testdata1, testdata2);

pValue = testclass2.pValue(0, "greater", testdata1, testdata2);

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

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

print("The confidence interval (null constructor)       = [" +

     confidenceInterval[0] + " , " + confidenceInterval[1] + "]");

 

Results:

The test statistic based on non-null constructor         =  2.348

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

The confidence interval based on non-null constructor   = [0.183 , 9.817]

The test statistic based on null constructor             =  2.348

The p-value based on null constructor                 =  0.022

The confidence interval based on null constructor       = [0.183 , 9.817]

 

See also:

Inference about the Difference: Match Samples