StatsCalculators.com

Mann-Whitney U Test

The Mann-Whitney U Test Calculator helps you perform non-parametric analysis to compare two independent groups. It determines whether samples originate from the same distribution by analyzing the ranks of the data rather than the raw values. This makes it particularly useful when your data violates the assumptions of the independent t-test, such as normality or equal variances. Common applications include comparing treatment outcomes between two groups, analyzing differences in measurements, or evaluating performance metrics across two departments. Click here to populate the sample data for a quick example.

Calculator

1. Load Your Data

2. Select Columns & Options

Yates' continuity correction improves accuracy for discrete data. Learn more

Learn More

Mann-Whitney U Test

Definition

Mann-Whitney U Test (also known as Wilcoxon rank-sum test) is a non-parametric alternative to the independent t-test. It compares two independent groups by analyzing the rankings of the data rather than the raw values.

Formula

U Statistics:

U1=n1n2+n1(n1+1)2R1U_1 = n_1n_2 + \frac{n_1(n_1+1)}{2} - R_1
U2=n1n2+n2(n2+1)2R2U_2 = n_1n_2 + \frac{n_2(n_2+1)}{2} - R_2
U=min(U1,U2)U = \min(U_1, U_2)

Where:

  • n1,n2n_1, n_2 = sample sizes
  • R1,R2R_1, R_2 = sum of ranks for group 1 and group 2
  • UU = the minimum of U₁ and U₂

Standardized Test Statistic:

z=Un1n22n1n2(n1+n2+1)12z = \frac{U - \frac{n_1n_2}{2}}{\sqrt{\frac{n_1n_2(n_1+n_2+1)}{12}}}

Correction for Ties:

When ties occur in the data, a correction is applied to the standard deviation:

σU=n1n2N(N1)(N3N12i=1gti3ti12)\sigma_U = \sqrt{\frac{n_1n_2}{N(N-1)} \left(\frac{N^3-N}{12} - \sum_{i=1}^g \frac{t_i^3-t_i}{12}\right)}
  • NN = total sample size (n1+n2n_1 + n_2)
  • gg = number of tied groups
  • tit_i = number of tied values in the ithi^{th} group

Continuity Correction:

z=Un1n220.5σUz = \frac{U - \frac{n_1n_2}{2} - 0.5}{\sigma_U}

The 0.5 term is the continuity correction, which improves the approximation to the normal distribution.

Effect Size

Effect size r for Mann-Whitney U test:

r=zNr = \frac{|z|}{\sqrt{N}}

Where:

  • zz = standardized test statistic
  • NN = total sample size

Interpretation:

  • Small effect: r0.1|r| \approx 0.1
  • Medium effect: r0.3|r| \approx 0.3
  • Large effect: r0.5|r| \approx 0.5

Key Assumptions

Independent Samples: Observations must be independent between and within groups
Ordinal Scale: Data must be at least ordinal (can be ranked)
Similar Shapes: Distributions should have similar shapes (for comparing medians)

Common Pitfalls

  • Using with paired/dependent samples (use Wilcoxon signed-rank instead)
  • Interpreting results as comparing means rather than distributions
  • Not checking for ties in the data when using exact calculations

Example without Ties

Problem Statement

A researcher wants to test if a treatment affects test scores. Students were randomly assigned to either control or treatment group, and their test scores were recorded:

Control group: 45, 47, 43, 44

Treatment group: 52, 48, 54, 50

Sample sizes: n1=n2=4n_1 = n_2 = 4

Step 1: State Hypotheses

H0H_0: The distributions of scores are the same for both groups.

H1H_1: The distributions of scores differ between the two groups.

α=0.05\alpha = 0.05

Step 2: Combine and Rank Data
GroupValueRank
Control431
Control442
Control453
Control474
Treatment485
Treatment506
Treatment527
Treatment548
Step 3: Calculate Rank Sums

Control rank sum (R₁): 1 + 2 + 3 + 4 = 10

Treatment rank sum (R₂): 5 + 6 + 7 + 8 = 26

Step 4: Calculate U Statistics
U1=(4)(4)+4(5)210=16+1010=16U_1 = (4)(4) + \frac{4(5)}{2} - 10 = 16 + 10 - 10 = 16U2=(4)(4)+4(5)226=16+1026=0U_2 = (4)(4) + \frac{4(5)}{2} - 26 = 16 + 10 - 26 = 0U=min(U1,U2)=min(16,0)=0U = \min(U_1, U_2) = \min(16, 0) = 0
Step 5: Calculate Z-Statistic
z=Un1n22n1n2(n1+n2+1)12z = \frac{U - \frac{n_1n_2}{2}}{\sqrt{\frac{n_1n_2(n_1+n_2+1)}{12}}}z=016216(9)12=2.3094z = \frac{0 - \frac{16}{2}}{\sqrt{\frac{16(9)}{12}}} = -2.3094
Step 6: Draw Conclusion

The pp-value for this test is 0.02090.0209. Since pp-value <0.05\lt 0.05, we reject H0H_0. There is sufficient evidence to conclude that the treatment and control groups have different distributions of scores.

Example with Ties

Problem Statement

A researcher wants to compare the effectiveness of two different teaching methods on student performance. Students were randomly assigned to either Method A or Method B, and their test scores were recorded:

Method A: 85, 92, 78, 90, 85, 76, 88

Method B: 79, 85, 81, 89, 84, 82, 85

Note that there are ties in the data: the score 85 appears three times (once in Method A and twice in Method B).

Step 1: State Hypotheses

H0H_0: The distributions of scores are the same for both teaching methods.

H1H_1: The distributions of scores differ between the two teaching methods.

Step 2: Combine and Rank Data
GroupValueRank
A761
A782
B793
B814
B825
B846
A858
B858
B858
A8810
B8911
A9012
A9213

Note: For the three tied values of 85, we assign the average rank of (7+8+9)/3 = 8 to each.

Step 3: Calculate Rank Sums

Method A rank sum (R₁): 1 + 2 + 8 + 10 + 12 + 13 = 46

Method B rank sum (R₂): 3 + 4 + 5 + 6 + 8 + 8 + 11 = 45

Step 4: Calculate U Statistics
U1=(6)(7)+6(7)246=42+2146=17U_1 = (6)(7) + \frac{6(7)}{2} - 46 = 42 + 21 - 46 = 17U2=(6)(7)+7(8)245=42+2845=25U_2 = (6)(7) + \frac{7(8)}{2} - 45 = 42 + 28 - 45 = 25U=min(U1,U2)=min(17,25)=17U = \min(U_1, U_2) = \min(17, 25) = 17
Step 5: Apply Correction for Ties

Since we have ties (three values of 85), we need to apply the correction to the standard deviation:

σU=n1n2N(N1)(N3N12i=1gti3ti12)\sigma_U = \sqrt{\frac{n_1n_2}{N(N-1)} \left(\frac{N^3-N}{12} - \sum_{i=1}^g \frac{t_i^3-t_i}{12}\right)}

Where N = 14, and we have one tied group with t = 3 (for the value 85).

σU=(6)(7)(13)(12)(133131233312)\sigma_U = \sqrt{\frac{(6)(7)}{(13)(12)} \left(\frac{13^3-13}{12} - \frac{3^3-3}{12}\right)}σU=42156(2184122412)=42156216012=6.96\sigma_U = \sqrt{\frac{42}{156} \left(\frac{2184}{12} - \frac{24}{12}\right)} = \sqrt{\frac{42}{156} \cdot \frac{2160}{12}} = 6.96
Step 6: Calculate Z-Statistic (no continuity correction)
z=Un1n22σUz = \frac{U - \frac{n_1n_2}{2}}{\sigma_U}z=17(6)(7)26.96=17216.96=46.96=0.574z = \frac{17 - \frac{(6)(7)}{2}}{6.96} = \frac{17 - 21}{6.96} = \frac{-4}{6.96} = -0.574
Step 7: Draw Conclusion

The pp-value for this test is 0.56600.5660 (two-sided). Since pp-value >0.05\gt 0.05, we fail to reject H0H_0. There is insufficient evidence to conclude that the two teaching methods result in different distributions of test scores.

Step 8: Calculate Effect Size
r=zN=0.57413=0.159r = \frac{|z|}{\sqrt{N}} = \frac{|-0.574|}{\sqrt{13}} = 0.159

This represents a small effect size, which aligns with our failure to reject the null hypothesis.

Verification

Related Calculators