pdk.Math.PermutationStatistics ($Date: 2002/12/04 10:16:02 $)
index
pdk/Math/PermutationStatistics.py

Code for performing permutation tests.

FOG 1999,07.2002

 
Classes
            
pdk.Base.OptionHandler
PermutationTest
PermutationStatistics
TwoMatrixPermutationStatistics
pdk.ErrorClasses.pdkError(exceptions.StandardError)
PermStatsError
PermutationTestError
 
class PermutationStatistics
     
Purpose:base class for permutation statistics
Detail:sets defaults for permutation mode (permutationMode), the compare function used to compute the alpha value (compareFunction) and the function used for checking proper input argument formats (inputCheckFunction; see the pdk.Math.__init__ module). Derived classes have to define a __call__ function which receives a (permuted) matrix conforming to the input specifications and returns the value of the test statistics.

 
   Methods defined here:
__call__(self, M)
__init__(self, permutationMode='rowsandcolumns', compareFunction=<ufunc 'greater'>, invertNegative=0, inputCheckFunction=None)
 
class PermutationTest(pdk.Base.OptionHandler)
     
Purpose:generic class for a permutation test.
Detail:needs to be passed a permutation statistics class during initialization, which serves as default.

 
   Methods defined here:
__call__(self, permutationM, *argT, **optionD)
Parameters:
  • permutationM: the 2d matrix to be tested
  • argT: may contain constructor arguments for the permutation statistics
  • optionD may contain keywords that set options of the permutaion procedure (e.g., "numberPermutations") and/or constructor keywords overriding defaults for the permutation statistics.
Value:a 2-tuple consisting of the reference value of the permutation statistics and the alpha value of the test

The dynamic instantiation of the permutation statistics class optimizes the use of permutation statistics that require more than one matrix as argument (see _CPCA as most complex example).

__init__(self, permutationStatisticsClass, **optionD)
getAlphaValue(self)
getNullDistribution = permutationsCopy(self, permutationM)
permutationsCopy(self, permutationM)
permutationsInPlace(self, permutationM)

Data and non-method functions defined here:
OPTIONS = {'numberPermuations': None, 'numericTypeCode': 'd', 'permutationStatisticsClass': 5000}
 
class PermutationTestError(pdk.ErrorClasses.pdkError)
       
  
Method resolution order:
PermutationTestError
pdk.ErrorClasses.pdkError
exceptions.StandardError
exceptions.Exception

Data and non-method functions defined here:
CODES = {'empty_reference_matrix': ('The reference data matrix is empty', ''), 'wrong_attribute_permutationMode': ('Unexpected setting for permuation mode', '')}
DOMAIN = 'Permutation Procedure Error'
 
class PermStatsError(pdk.ErrorClasses.pdkError)
       
  
Method resolution order:
PermStatsError
pdk.ErrorClasses.pdkError
exceptions.StandardError
exceptions.Exception

Data and non-method functions defined here:
CODES = {'wrong_matrix_format': ('Malformed input matrix', '')}
DOMAIN = 'Permutation Statistics Error'
 
class TwoMatrixPermutationStatistics(PermutationStatistics)
     
Purpose:base class for two-matrix permuation statistics
Detail:a special class of permutation statistics where two matrices are required to compute the value of the test statistics, one that remains unaltered (passed as referenceM to the constructor) and the usual permuted one (passed to the __call__ method defined by derived classes).

 
   Methods defined here:
__init__(self, referenceM, indicatorMatrix=None)
 
Functions
            
cpca(*argT, **optionD)
delta_wawga(*argT, **optionD)
geary_c(x, W)
mantel_r(*argT, **optionD)
mantel_z(*argT, **optionD)
moran_i(x, W)
rohm_e(*argT, **optionD)
wawga(*argT, **optionD)
 
Data
             PERMUTATION_MODE_RANDOM = 'random'
PERMUTATION_MODE_ROWS = 'rows'
PERMUTATION_MODE_COLUMNS = 'columns'
PERMUTATION_MODE_ROWS_AND_COLUMNS = 'rowsandcolumns'
PERMUTATION_MODE_SYMMETRIC = 'symmetric'
SCOPE_FULL = 'full'
SCOPE_SUBSET = 'subset'
mantel_test = instance of PermutationTest
neighborhood_test = instance of PermutationTest
 
Author
            
$Author: gathmann $