Understanding bootstrap hypothesis testing I want to use bootstrap hypothesis testing to test if the mean of 1 distribution is greater than the other. With no other assumptions on the two distributions (e.g., they don't need to be gaussian).
I found this paragraph in the wikipedia article:
https://en.wikipedia.org/wiki/Bootstrapping_(statistics)#Bootstrap_hypothesis_testing
I have two questions:

*

*Is the algorithm indicated in the link above testing for the hypothesis -- "the mean of X is greater than the mean of Y"? i.e., the null hypothesis being "the mean of X is not greater than the mean of Y". If it's not testing for this, how can we test for this?



*What is Step 2 doing?

I'm rather confused at this:
Create two new data sets whose values are: 
x_i^' = x_i - X + Z and 
y_i^' = y_i - Y + Z 
where Z is the mean of the combined sample.

At a high level, this seems to be "normalizing" samples with the joint mean. Why is this needed?

Regarding testing the null hypothesis (H0) "the mean of X is not greater than the mean of Y" vs. the alternative "the mean of X is greater than the mean of Y":
In fact, the algorithm on the Wikipedia page is written down so that it rejects the H0 if the sample mean $\bar x$ is larger than $\bar y$ by enough distance, indicating a larger true mean of the $x$-data. If it is smaller, the H0 will not be rejected. This can be changed by changing the "$\ge$" to "$\le$" in step 6, or by taking absolute values of $t^*$ and $t$. However, in the current form I'd say it does what you want to do.
Formally, the null hypothesis of the test is that the two means are equal, because the distribution of the test statistic is simulated by bootstrap assuming that the means are equal. This is however not different from the standard (non-bootstrap) two-sample t-test. The reason why the H0 can there be stated as "mean of X is not greater as mean of Y" is that it can be proved that if in fact the mean of Y is larger, the rejection probability of the H0 is even smaller than if the means are equal, so that the test, even though computed assuming equality, is "unbiased" if the mean of Y is even larger.
This cannot be proved for the bootstrap test, or at least not as long as you are not willing to make further assumptions, because the nonparametric class of possible models is just too rich and all kinds of weird stuff can happen  (I presume but am not sure that a mean shift model will do). Nevertheless, the bootstrap test is constructed so that it should tend to reject if the X-mean is larger, and should not tend to reject if the Y-mean is larger, so I think it allows the kind of interpretation that you have in mind.
