'pairwise comparison for kruskal-wallis test
This is just a reimplementation of scipy.stats.kruskal and does
not yet use a multiple comparison correction.'

def kruskal(self, pairs=None, multimethod='T'):

    self.getranks()
    tot = self.nobs
    meanranks = self.ranks.groupmean
    groupnobs = self.ranks.groupnobs
    f = (((tot * (tot + 1.0)) / 12.0) / stats.tiecorrect(self.rankdata))
    print('MultiComparison.kruskal')
    for (i, j) in zip(*self.pairindices):
        pdiff = np.abs((meanranks[i] - meanranks[j]))
        se = np.sqrt((f * np.sum((1.0 / groupnobs[[i, j]]))))
        Q = (pdiff / se)
        print(i, j, pdiff, se, (pdiff / se), ((pdiff / se) > 2.631))
        print((stats.norm.sf(Q) * 2))
        return (stats.norm.sf(Q) * 2)
