def ranksums(x, y):
 (x, y) = map(np.asarray, (x, y))
 n1 = len(x)
 n2 = len(y)
 alldata = np.concatenate((x, y))
 ranked = rankdata(alldata)
 x = ranked[:n1]
 s = np.sum(x, axis=0)
 expected = ((n1 * ((n1 + n2) + 1)) / 2.0)
 z = ((s - expected) / np.sqrt((((n1 * n2) * ((n1 + n2) + 1)) / 12.0)))
 prob = (2 * distributions.norm.sf(abs(z)))
 return RanksumsResult(z, prob)

def ranksums ( x , y ) : ( x , y ) = map ( np . asarray , ( x , y ) ) n1 = len ( x ) n2 = len ( y ) alldata = np . concatenate ( ( x , y ) ) ranked = rankdata ( alldata ) x = ranked [ : n1 ] s = np . sum ( x , axis = 0 ) expected = ( ( n1 * ( ( n1 + n2 ) + 1 ) ) / 2.0 ) z = ( ( s - expected ) / np . sqrt ( ( ( ( n1 * n2 ) * ( ( n1 + n2 ) + 1 ) ) / 12.0 ) ) ) prob = ( 2 * distributions . norm . sf ( abs ( z ) ) ) return RanksumsResult ( z , prob )
compute the wilcoxon rank-sum statistic for two samples .