
Java Statistical Classes  
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object  +jsc.tests.ResampleTest
Root class for resampling significance tests. This is the root class for significance tests that involve
some form of resampling, such as bootstrap and permutation tests. Subclasses must
provide method resample()
to generate random bootstrap samples, and a constructor
that sets up the appropriate data from which the samples are drawn.
Method calculateSP()
calculates the significance probability of the bootstrap test.
That is, it calculates the statistic for bootstrap samples drawn in some way from the original data,
and calculates 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 access to the individual bootstrap sample statistics are required (e.g. to examine their
distribution or for teaching purposes), a StatisticListener
object can be supplied in the
constructor, or added using the addStatisticListener
method.
Note that events are fired by method calculateSP()
, so if the subclass calls this method
from its constructor it need a nonnull listener parameter.
Field Summary  
protected Random 
rand
Pseudorandom number generator for random generation of bootstrap samples. 
protected Set 
statisticListeners
Set of registered objects listening for sampling events from this class. 
Constructor Summary  
ResampleTest(double t,
Tail tail,
StatisticListener listener)
Instantiate the object. 
Method Summary  
void 
addStatisticListener(StatisticListener listener)
Adds a listener for any events fired by a sampling event. 
protected abstract double 
bootstrapSample()
Calculate the statistic for a single bootstrap sample. 
double 
calculateSP(int repCount)
Estimate the significance probability by taking a random sample of bootstraps. 
double 
getSP()
Returns the achieved significance level of the bootstrap test. 
double 
getTestStatistic()
Returns value of the original observed statistic. 
long 
getTotalRepCount()
Returns the total number of random bootstrap replications. 
void 
removeStatisticListener(StatisticListener listener)
Remove a listener. 
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 
Field Detail 
protected Random rand
protected Set statisticListeners
Constructor Detail 
public ResampleTest(double t, Tail tail, StatisticListener listener)
t
 the original observed statistic value.tail
 indicates which tail of the distribution of t is to be used to calculate the SP.listener
 a listener for accessing random bootstrap statistics; or null.Method Detail 
protected abstract double bootstrapSample()
public double calculateSP(int repCount)
StatisticEvent
event for any registered listeners.
repCount
 the number of random bootstrap replications.
public double getSP()
calculateSP()
has not be called.
getSP
in interface SignificanceTest
public double getTestStatistic()
getTestStatistic
in interface SignificanceTest
public long getTotalRepCount()
public void setSeed(long seed)
seed
 a seed value.public void addStatisticListener(StatisticListener listener)
public void removeStatisticListener(StatisticListener listener)

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