
Java Statistical Classes  
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object  +jsc.tests.PermutationTest
General permutation test.
Given any statistic that can be recalculated for permutations of its data (i.e. that
implements the PermutableStatistic
interface),
this class calculates the significance probability of the permutation test using the
original statistic value t. That is, it calculates the statistic for permutations of the
original data, and finds the proportion of these that are less than or equal to t (Tail.LOWER),
greater than or equal to t (Tail.UPPER), or either (Tail.TWO), where t is the original
observed statistic value.
If all permutations are used, and the statistic is a distributionfree test statistic, this proportion often provides the exact SP of the distributionfree test. If the statistic is a parametric test, it provides a SP that is independent of the distribution of the observations assumed under the null hypothesis of the original test. Alternatively, these calculations can be performed for random samples of permutations, in which case the proportion is an approximation to the exact SP.
Note that calculating the test statistic for all permutations is suitable only for small samples. The time taken to perform the calculations for moderate or large samples may be unacceptable, depending on the computations involved in calculating the statistic. This general class should not be used where algorithms or classes are available for specific statistics, when it is often the case that the calculations can be streamlined, or good approximations are available.
If access to the individual permutation statistics are required (e.g. to examine their
distribution or for teaching purposes), a StatisticListener
object can be supplied in the
constructor. Alternatively, add appropriate listeners to the object that implements the
PermutableStatistic
interface, which may also give access to the permutation samples.
Constructor Summary  
PermutationTest(PermutableStatistic statistic)
Create permutation test. 

PermutationTest(PermutableStatistic statistic,
Tail tail)
Create permutation test. 

PermutationTest(PermutableStatistic statistic,
Tail tail,
boolean monteCarlo,
int repCount)
Create permutation test. 

PermutationTest(PermutableStatistic statistic,
Tail tail,
boolean monteCarlo,
int repCount,
double tolerance)
Create permutation test. 

PermutationTest(PermutableStatistic permutableStatistic,
Tail tail,
boolean monteCarlo,
int repCount,
double tolerance,
StatisticListener listener)
Create permutation test. 
Method Summary  
double 
calculateSP()
Calculate the significance probability using all possible permutations. 
double 
calculateSP(int repCount)
Estimate the significance probability by taking a random sample of permutations. 
double 
calculateSP(int repCount,
double tolerance)
Estimate the significance probability by taking random samples of permutations. 
double 
getPermutationCount()
Returns the total number of possible permutations. 
double 
getSP()
Returns the achieved significance level of the permutation test. 
double 
getTestStatistic()
Returns value of the original observed statistic. 
double 
getTotalRepCount()
Returns the total number of permutations used. 
void 
setSeed(long seed)
Initialize the random number generator with a seed value. 
Methods inherited from class java.lang.Object 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Constructor Detail 
public PermutationTest(PermutableStatistic permutableStatistic, Tail tail, boolean monteCarlo, int repCount, double tolerance, StatisticListener listener)
tail
 indicates which tail of the distribution is to be used to calculate the SP.monteCarlo
 if true, a Monte Carlo estimate of the SP; if false, all permutations are used.repCount
 the size of a sample of random permutations (ignored if monteCarlo is false).tolerance
 the tolerance for stopping Monte Carlo sampling (ignored if monteCarlo is false).listener
 a listener for accessing permutatation statistics; or null.public PermutationTest(PermutableStatistic statistic, Tail tail, boolean monteCarlo, int repCount, double tolerance)
statistic
 the permutable statistic.tail
 indicates which tail of the distribution is to be used to calculate the SP.monteCarlo
 if true, a Monte Carlo estimate of the SP; if false, all permutations are used.repCount
 the size of a sample of random permutations (ignored if monteCarlo is false).tolerance
 the tolerance for stopping Monte Carlo sampling (ignored if monteCarlo is false).public PermutationTest(PermutableStatistic statistic, Tail tail, boolean monteCarlo, int repCount)
statistic
 the permutable statistic.tail
 indicates which tail of the distribution is to be used to calculate the SP.monteCarlo
 if true, a Monte Carlo estimate of the SP; if false, all permutations are used.repCount
 the size of the sample of random permutations (ignored if monteCarlo is false).public PermutationTest(PermutableStatistic statistic, Tail tail)
statistic
 the permutable statistic.tail
 indicates which tail of the distribution is to be used to calculate the SP.public PermutationTest(PermutableStatistic statistic)
statistic
 the permutable statistic.Method Detail 
public double calculateSP()
public double calculateSP(int repCount)
repCount
 the number of random permutation replications.
public double calculateSP(int repCount, double tolerance)
repCount
 the number of random permutation replications.tolerance
 the tolerance for stopping sampling.
public double getPermutationCount()
public double getSP()
getSP
in interface SignificanceTest
public double getTestStatistic()
getTestStatistic
in interface SignificanceTest
public double getTotalRepCount()
public void setSeed(long seed)
seed
 a seed value.

Java Statistical Classes  
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 