# How to bootstrap for the standard error of a two sample test

I want to calculate the standard error of the area under the curve computed with the Mann-Whitney U-Test (MWUT).

Hanley and McNeil 1982 give a formula for it (they call the AUC calculated with the MWUT "W"). However I'm finding this hard to implement so I'd like to bootstrap it to check/replace my work.

My question is how do I sample from the two distributions to perform the bootstrap? Shall I resample from them independently or resample from the whole set together and keep track of the case labels?

Another concern I have is how the resampling will affect the MWUT, given that there will be tied ranks.

• Just a question: why are you interested in the standard error and not, e.g., a confidence interval? Sep 25 '13 at 1:58
• i'm using the standard error to estimate a confidence interval. true, this could be directly estimated using the bootstrap, but i'd like to ultimately use the formulas given for the SE approximation. Oct 7 '13 at 20:49

I believe you would put both samples together since under the null hypothesis they are supposed to be equal. Then you bootstrap by selecting from the total sample taking care to identify each of the two groups. You might try something like the following:

library(boot)
grp1<-rbinom(15,10,.3)  #simulated group 1 values
grp2<-rbinom(12,10,.5)  #simulated group 2 values
values<-c(grp1,grp2)    #combinding the values into one set

myfun=function(values,i)

{

grps=as.factor(c(rep('A',15),rep('B',12)))  # index each group
wilcox.test(values[i]~grps)$statistic # WMW test extracting its statistic } myboot=boot(data=values,statistic=myfun,R=2000) t hist(myboot$t)


The reason the grps variable is created inside the function is that if done on the outside, the bootrap sampling would sample the codes and you would not get the groupings as you desire.

hope this helps.

• I'm not convinced that pooling and resampling is the correct approach. The bootstrap is to estimate the SE, so it seems reasonable to keep the group sizes the same (which pooling would not do). I think the pooling you suggest is more appropriate for a permutation test... Jul 29 '13 at 15:58
• @dylan2106 If your sample is large, it probably won't make a big difference whether you sample from a pooled or non-pooled dataset. Just take a lot of bootstrap samples and compare. For what it's worth, Efron & Tibshirani (1994) in at least one case do not pool when they do a permutation test (Algorithm 15.1, p. 208). Sep 25 '13 at 1:54
• @JoeF Where does t come from after the call to boot? Sep 25 '13 at 1:56
• jason, after you run the boot, if you type the command namesImyboot) you will see all the stored parameters, The t is the generated replicates from boot. if you type the command myboot\$t you will see these Aug 3 '20 at 21:12