def rTestDS(D,tag): """perform a robust, non-parametric, rank test on direct scatter. Specifically we find the within and between class distances, we calculate the median and the calculate a one sided Rank Sum test that the between class distances are larger then the pair wise distance. D distance matrix, nxn np array tag class labels as integers 0,..,K, n np int vector NOTE: that the distances are pair-wise so they are not independent, ie the samples in SW or SB """ D,tag = pp(D,tag) sw,sb = sepScat(D,tag) p,_ = statsUtil.rankSum1S(sb,sw) return(p)
def rTestMS_cust1(D,tag): """This is a custom method for a specific analysis in which we get the mean scatter of D and test if tag==1 > tag==0 in terms of a ranked sum test Only use this for the ptb binary label. """ newTag = np.array(np.zeros(len(tag)),dtype=int) newTag[tag=='TRUE'] = 1 D,tag = pp(D,tag) meanScat = calcMeanScat(D) # because the preproc (pp) does not # care about the values we have to be careful # we are x = meanScat[newTag==1] y = meanScat[newTag==0] p1s,_ = statsUtil.rankSum1S(x,y) p2s,_ = statsUtil.rankSum(x,y) return(p1s,p2s)