R/testfunc.wilcox.ties.general.R

Defines functions `testfunc.wilcox.ties.general`

`testfunc.wilcox.ties.general` <-
function(d){
    r <- rank(d$W)
    n0 <- length(d$Z[d$Z==0])
    n1 <- length(d$Z[d$Z==1])
    STATISTIC <- sum(r[d$Z==0]) - n0 * (n0 + 1)/2
    NTIES <- table(r)
    SIGMA <- sqrt((n0 * n1/12) * ((n0 + n1 + 1) - 
            sum(NTIES^3 - NTIES)/((n0 + n1) * (n0 + n1 - 
              1))))
    out<-  (STATISTIC - n0 * n1/2)/SIGMA
    #pval<-pnorm(out)
    #return(pval)
    return(out) 
}

Try the choplump package in your browser

Any scripts or data that you put into this service are public.

choplump documentation built on May 9, 2022, 5:08 p.m.