1. Mann-Whitney U test
A Mann-Whitney U test is similar to the independent t-test.
2. Mann-Whitney U
Suppose when assessing the distributions of time to eat Cheese and Pepperoni pizzas, our histograms were not normally distributed and there is no reason to believe the population distribution is normal.
Now we need to use a non-parametric test, as they do not assume a distribution shape.
The Mann-Whitney U test is the non-parametric equivalent to the independent sample t-test.
3. Assumptions
Though the distribution shape is not assumed in the Mann-Whitney U test, the groups should follow the same shape, such as both bell-shaped and skewing left.
Additionally, while the t-test assesses for a difference in means, the Mann-Whitney U tests for a difference in medians.
In a normal distribution, the mean and median are equal, but in a non-normal distribution, the median is more appropriate.
The assumptions of the t-test allow for a more powerful test provided the distributions are normal.
However, when distributions are not normal, the t-test assumptions are not met and the Mann-Whitney U test is more appropriate and powerful.
The null hypothesis of the Mann-Whitney U test is the median of time to eat Cheese and Pepperoni pizza are equal.
Again, we can create a histogram to investigate the distribution shape. Note the similar asymmetry in these histograms, indicating the non-parametric Mann-Whitney U test should be used to test group differences.
4. Sample Size
Given the Mann-Whitney U tests assumptions, we calculate the sample size using the two proportions pwr function.
We first give the expected effect size. The most common effect size for Mann-Whitney U tests is the rank-biserial correlation r, which helps us see how subjects in Group A rank in comparison to Group B. It denotes the difference between the proportion of ranks favorable and unfavorable to the hypothesis. We expect a mid effect size of point-4. In pwr-dot-2p2n-dot-test, give the point-4 effect size as h, significance of point-0-5 as sig-dot-level, power of point-8, and n-1 with the number of participants anticipated in one group, Cheese, 100.
We need a total of 197, or 97 participants in our Pepperoni group.
Note if we change the number of Cheese participants, the Pepperoni participant number changes, but the total sample size remains similar.
5. Test
Recall the Mann-Whitney U test can be run with the wilcox-dot-test function, using the standard formula of y tilde x where y is the data column and x is the group column.
This test is significant, indicating the medians of time to eat Cheese and Pepperoni pizza are different. W represents our Mann-Whitney U-value, or sum of the rankings. A smaller value indicates less likelihood of obtaining the results by chance.
6. Effect size and power
We must determine our actual effect size to derive the power of our Mann-Whitney U results.
In rank-underscore-biserial of the effectsize package, use the same formula and data arguments as before.
Given that point-1 is small, point-3 is medium, and point-5 is large, our effect size r is about medium at point-2-1, indicating a small effect and difference in the groups.
To determine the power, give the point-2-1 effect size in h, test significance of point-01, and sample size of both groups, each 100.
Despite our significant p-value and appropriate sample size, our power is small at point-1-4,
indicating a 86% chance of an error in rejecting the difference in toppings when we should not have. The small power and high likelihood of an error indicates high confidence cannot be given to these results. An error is likely to have been found in testing the median time to eat Cheese and Pepperoni pizza.
7. Let's practice!
Let's work on Mann-Whitney U tests.