It is a test to compare two groups to see if one tends to have larger values than the other, without assuming the data follows a normal distribution.
Click to reveal answer
beginner
What kind of data does the Mann-Whitney U test work with?
It works with two independent samples of ordinal or continuous data that do not need to be normally distributed.
Click to reveal answer
beginner
In Python's scipy library, which function performs the Mann-Whitney U test?
The function is scipy.stats.mannwhitneyu.
Click to reveal answer
beginner
What does the p-value from the Mann-Whitney U test tell us?
It tells us how likely it is to see the observed difference between groups if there was actually no difference.
Click to reveal answer
beginner
What is the null hypothesis in the Mann-Whitney U test?
The null hypothesis is that the two groups come from the same distribution, meaning no difference in their values.
Click to reveal answer
What does the Mann-Whitney U test compare?
ATwo independent groups without assuming normal distribution
BTwo paired groups assuming normal distribution
CMore than two groups with normal distribution
DCorrelation between two variables
✗ Incorrect
The Mann-Whitney U test compares two independent groups without assuming the data is normally distributed.
Which scipy function runs the Mann-Whitney U test?
Ascipy.stats.ttest_ind
Bscipy.stats.mannwhitneyu
Cscipy.stats.chi2_contingency
Dscipy.stats.pearsonr
✗ Incorrect
scipy.stats.mannwhitneyu is the function for the Mann-Whitney U test.
What does a small p-value from the Mann-Whitney U test indicate?
AStrong evidence that the two groups differ
BNo difference between groups
CData is normally distributed
DTest was not performed correctly
✗ Incorrect
A small p-value means strong evidence against the null hypothesis, suggesting the groups differ.
Which assumption is NOT required for the Mann-Whitney U test?
ASamples are independent
BGroups have similar shapes
CData is ordinal or continuous
DData is normally distributed
✗ Incorrect
The Mann-Whitney U test does NOT require data to be normally distributed.
If the Mann-Whitney U test returns U=0, what does it mean?
ATest failed to run
BBoth groups have identical values
COne group has all smaller values than the other
DGroups are perfectly correlated
✗ Incorrect
U=0 means all values in one group are smaller than all values in the other group.
Explain in your own words what the Mann-Whitney U test does and when you would use it.
Think about comparing two groups when you can't assume normal data.
You got /4 concepts.
Describe how to perform the Mann-Whitney U test using scipy and interpret the results.
Focus on the function call and what the output numbers mean.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of the Mann-Whitney U test in data analysis?
easy
A. To test if a single sample mean equals a known value
B. To compare two independent groups without assuming normal distribution
C. To measure the correlation between two variables
D. To analyze the variance among multiple groups
Solution
Step 1: Understand the test purpose
The Mann-Whitney U test is a non-parametric test used to compare two independent groups.
Step 2: Identify the key feature
It does not assume the data follows a normal distribution, unlike t-tests.
Final Answer:
To compare two independent groups without assuming normal distribution -> Option B
Quick Check:
Non-parametric comparison = C [OK]
Hint: Remember: Mann-Whitney compares two groups without normality [OK]
Common Mistakes:
Confusing it with correlation tests
Assuming it compares means only
Using it for more than two groups
2. Which of the following is the correct way to import the Mann-Whitney U test function from scipy?
easy
A. import scipy.mannwhitneyu as mw
B. import mannwhitneyu from scipy.stats
C. from scipy import mann_whitney_u_test
D. from scipy.stats import mannwhitneyu
Solution
Step 1: Recall scipy.stats module functions
The Mann-Whitney U test function is named mannwhitneyu and is inside scipy.stats.
Step 2: Check correct import syntax
The correct Python import syntax is from scipy.stats import mannwhitneyu.
Final Answer:
from scipy.stats import mannwhitneyu -> Option D
Quick Check:
Correct import syntax = B [OK]
Hint: Use 'from scipy.stats import mannwhitneyu' to import [OK]
Common Mistakes:
Using wrong module or function name
Incorrect import syntax
Trying to import with 'import ... as' incorrectly
3. What will be the output of the following code snippet?
from scipy.stats import mannwhitneyu
x = [1, 3, 5]
y = [2, 4, 6]
stat, p = mannwhitneyu(x, y)
print(round(stat, 2), round(p, 3))
medium
A. 3.0 0.5
B. 4.5 0.25
C. 6.0 0.05
D. 0.0 1.0
Solution
Step 1: Understand the data and test
Lists x and y have values [1,3,5] and [2,4,6]. Mann-Whitney U test compares ranks between these two groups.
Step 2: Calculate Mann-Whitney U statistic and p-value
Using scipy, the U statistic is 3.0 and p-value is 0.5 (two-sided test by default).
Final Answer:
3.0 0.5 -> Option A
Quick Check:
U=3.0, p=0.5 from scipy output [OK]
Hint: Run code to get exact U and p values quickly [OK]
Common Mistakes:
Mixing up U statistic with p-value
Rounding incorrectly
Assuming p-value is always small
4. Identify the error in this Mann-Whitney U test code and select the fix:
from scipy.stats import mannwhitneyu
x = [1, 2, 3]
y = [4, 5, 6]
stat, p = mannwhitneyu(x, y, alternative='greater')
print(stat, p)
medium
A. Replace mannwhitneyu with mann_whitney_u
B. Change 'alternative' to 'two-sided'
C. No error; code runs correctly
D. Use 'alternative="greater"' with capital G
Solution
Step 1: Check function parameters
The mannwhitneyu function accepts an alternative parameter with values 'two-sided', 'less', or 'greater'.
Step 2: Verify code correctness
Using alternative='greater' is valid and the function call is correct.
Final Answer:
No error; code runs correctly -> Option C
Quick Check:
Correct parameter usage = D [OK]
Hint: Check scipy docs for valid 'alternative' values [OK]
Common Mistakes:
Using wrong alternative string case
Trying to use non-existent function names
Assuming default alternative is 'greater'
5. You have two small samples with skewed data: a = [2, 3, 5, 7] and b = [1, 4, 6, 8]. You want to test if sample a tends to have higher values than b. Which scipy Mann-Whitney U test call is correct?
hard
A. mannwhitneyu(a, b, alternative='greater')
B. mannwhitneyu(a, b, alternative='less')
C. mannwhitneyu(a, b, alternative='two-sided')
D. mannwhitneyu(b, a, alternative='greater')
Solution
Step 1: Define the hypothesis direction
We want to test if a tends to have higher values than b, so the alternative hypothesis is 'greater'.
Step 2: Choose correct function call
The call should be mannwhitneyu(a, b, alternative='greater') to test if a is stochastically greater than b.
Final Answer:
mannwhitneyu(a, b, alternative='greater') -> Option A
Quick Check:
Test if a > b = A [OK]
Hint: Use 'alternative="greater"' when testing if first sample is larger [OK]
Common Mistakes:
Swapping sample order and alternative incorrectly
Using 'less' when testing for greater
Choosing 'two-sided' when direction matters
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.