choplumpGeneral | R Documentation |
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.
choplumpGeneral(W, Z, testfunc=testfunc.wilcox.ties.general)
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 |
Returns a p-value vector of length 3, with 3 named values: p.lower, p.upper, p.2sided.
### 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.