choplumpGeneral {choplump} | R Documentation |
General choplump test
Description
This function does a general choplump test. For simple difference in standardized
means (on the responses or on the ranks), use the much faster choplump
function.
Usage
choplumpGeneral(W, Z, testfunc=testfunc.wilcox.ties.general)
Arguments
W |
numeric vector of responses, some should be zero |
Z |
numeric vector of group membership, values either 0 or 1 |
testfunc |
test function, inputs a data frame with two columns labeled W and Z, outputs test statistic |
Value
Returns a p-value vector of length 3, with 3 named values: p.lower, p.upper, p.2sided.
Examples
### compare speed and results using two different functions
W<-c(0,0,0,0,0,0,0,0,2,4,6)
Z<-c(0,0,0,0,1,1,1,1,0,1,1)
Testfunc<-function(d){
W<-d$W
Z<-d$Z
N<-length(Z)
sqrt(N-1)*(sum(W*(1-Z)) - N*mean(W)*mean(1-Z) )/
sqrt(var(W)*var(1-Z))
}
time0<-proc.time()
choplumpGeneral(W,Z,Testfunc)
time1<-proc.time()
choplump(W~Z,use.ranks=FALSE)$p.values
time2<-proc.time()
time1-time0
time2-time1
[Package choplump version 1.1.2 Index]