org.statcato.statistics.inferential.nonparametrics
Class SignTest

java.lang.Object
  extended by org.statcato.statistics.inferential.nonparametrics.SignTest

public class SignTest
extends java.lang.Object

Sign test. Determines the likelihood of observing a specified number of observations above and below the hypothesized median.

Since:
1.0
Version:
%I%, %G%
Author:
Margaret Yau

Field Summary
static int GREATER
          Alternative hypothesis type: greater than
static int LESS
          Alternative hypothesis type: less than
static int NOTEQUAL
          Alternative hypothesis type: not equal to
static int THRESHOLD
          Sample size threshold for for normal approximation to binomial
 
Constructor Summary
SignTest(int numPositive, int numNegative, double testMedian, int testType)
          Constructor, given summary data.
SignTest(java.util.Vector<java.lang.Double> data, double testMedian, int testType)
          Constructor, given data values.
 
Method Summary
 double pValue()
          Returns the p-value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LESS

public static int LESS
Alternative hypothesis type: less than


GREATER

public static int GREATER
Alternative hypothesis type: greater than


NOTEQUAL

public static int NOTEQUAL
Alternative hypothesis type: not equal to


THRESHOLD

public static int THRESHOLD
Sample size threshold for for normal approximation to binomial

Constructor Detail

SignTest

public SignTest(int numPositive,
                int numNegative,
                double testMedian,
                int testType)
Constructor, given summary data.

Parameters:
numPositive - number of positive signs
numNegative - number of negative signs
testMedian - hypothesized median
testType - type of alternative hypothesis

SignTest

public SignTest(java.util.Vector<java.lang.Double> data,
                double testMedian,
                int testType)
Constructor, given data values.

Parameters:
data - vector of double data values
testMedian - hypothesized median
testType - type of alternative hypothesis
Method Detail

pValue

public double pValue()
Returns the p-value. Uses the exact binomial probabilities if if the sample size (excluding sample equal to the hypothesized median) is less than or equal to the sample size threshold; otherwise, uses normal approximation to binomial.

Returns:
p-value
See Also:
THRESHOLD

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object