TAMO.util.WMWtest
index
/home/David_Gordon/docs/TAMO/util/WMWtest.py

Routines and interface for computing Mann-Whitney (Wilcoxon two-sample test)
 
Copyright (2005) Whitehead Institute for Biomedical Research (except as noted below)
All Rights Reserved
 
Author: David Benjamin Gordon
 
##
## Ported from perl code obtained from:
## https://www.fon.hum.uva.nl/Service/Statistics/Wilcoxon_Test.html
 
## COMMENTS are from original PERL code, which had the following
## information included in it:
##
##     Copyright (C) 1996, 2001  Rob van Son
##     
##     This program is free software; you can redistribute it and/or
##     modify it under the terms of the GNU General Public License
##     as published by the Free Software Foundation; either version 2
##     of the License, or (at your option) any later version.
##     
##     This program is distributed in the hope that it will be useful,
##     but WITHOUT ANY WARRANTY; without even the implied warranty of
##     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##     GNU General Public License for more details.
##     
##     You should have received a copy of the GNU General Public License
##     along with this program(*); if not, write to the Free Software
##     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
#############################################################################
## (*) Note: TAMO does not redistribute any source code from Rob van Son ####
#############################################################################

 
Modules
       
TAMO.util.Arith
sys

 
Functions
       
CountSmallerRanks(W, Sum, m, Start, RankList)
## This routine recursively counts the number of distributions of ranks over two
## samples for which the sum of the ranks in the smaller sample is smaller than or
## equal to a given upper bound W.
## W = the bound, Sum = the sum of ranks upto now, m-1 = one less than the
## number of elements in the smaller sample that still have to be done, 
## Start = the current position in the ranks list, *ankList = the array
## with all the ranks (this is NOT just the numbers from 1 - N because of ties).
## The list with ranks MUST be sorted in INCREASING order.
WMWtest(A, B)
WMWtest(A,B) -- Computes the Wilcoxon-Mann-Whitney nonparametric W statistic for two distributions
 
input:  list of numbers, list of numbers
output: p-value, W-statistic
acos(...)
acos(x)
 
Return the arc cosine (measured in radians) of x.
asin(...)
asin(x)
 
Return the arc sine (measured in radians) of x.
atan(...)
atan(x)
 
Return the arc tangent (measured in radians) of x.
atan2(...)
atan2(y, x)
 
Return the arc tangent (measured in radians) of y/x.
Unlike atan(y/x), the signs of both x and y are considered.
ceil(...)
ceil(x)
 
Return the ceiling of x as a float.
This is the smallest integral value >= x.
cos(...)
cos(x)
 
Return the cosine of x (measured in radians).
cosh(...)
cosh(x)
 
Return the hyperbolic cosine of x.
degrees(...)
degrees(x) -> converts angle x from radians to degrees
exp(...)
exp(x)
 
Return e raised to the power of x.
fabs(...)
fabs(x)
 
Return the absolute value of the float x.
floor(...)
floor(x)
 
Return the floor of x as a float.
This is the largest integral value <= x.
fmod(...)
fmod(x,y)
 
Return fmod(x, y), according to platform C.  x % y may differ.
frexp(...)
frexp(x)
 
Return the mantissa and exponent of x, as pair (m, e).
m is a float and e is an int, such that x = m * 2.**e.
If x is 0, m and e are both 0.  Else 0.5 <= abs(m) < 1.0.
hypot(...)
hypot(x,y)
 
Return the Euclidean distance, sqrt(x*x + y*y).
k_out_n(k, n)
## Calculate k out n
ldexp(...)
ldexp(x, i) -> x * (2**i)
log(...)
log(x[, base]) -> the logarithm of x to the given base.
If the base not specified, returns the natural logarithm (base e) of x.
log10(...)
log10(x) -> the base 10 logarithm of x.
main()
modf(...)
modf(x)
 
Return the fractional and integer parts of x.  Both results carry the sign
of x.  The integer part is returned as a real.
pow(...)
pow(x,y)
 
Return x**y (x to the power of y).
radians(...)
radians(x) -> converts angle x from degrees to radians
sin(...)
sin(x)
 
Return the sine of x (measured in radians).
sinh(...)
sinh(x)
 
Return the hyperbolic sine of x.
sqrt(...)
sqrt(x)
 
Return the square root of x.
tan(...)
tan(x)
 
Return the tangent of x (measured in radians).
tanh(...)
tanh(x)
 
Return the hyperbolic tangent of x.

 
Data
        e = 2.7182818284590451
pi = 3.1415926535897931