import javastat.inference.onesample.OneSampProp;

 

/**

 *

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

 */

 

 

testclass1 = new OneSampProp(0.05, 0.5, "less", 30, 100);

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 OneSampProp();

confidenceInterval = testclass2.confidenceInterval(0.05, 30, 100);

testStatistic = testclass2.testStatistic(0.5, 30, 100);

pValue = testclass2.pValue(0.5, "greater", 30, 100);

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         =  -4.0

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

The confidence interval based on non-null constructor   = [0.21 , 0.39]

The test statistic based on null constructor             =  -4.0

The p-value based on null constructor                 =  1.0

The confidence interval based on null constructor       = [0.21 , 0.39]

 

See also:

Population Proportion,

Tests about a Population Proportion