It is a test to compare two related samples to see if their population median ranks differ. It helps check if there is a difference between paired data without assuming normal distribution.
Click to reveal answer
beginner
What kind of data is suitable for the Wilcoxon signed-rank test?
Paired or matched samples where you want to compare differences, especially when data is not normally distributed or sample size is small.
Click to reveal answer
beginner
Which Python library provides the Wilcoxon signed-rank test function?
The 'scipy.stats' module provides the function 'wilcoxon()' to perform the Wilcoxon signed-rank test.
Click to reveal answer
intermediate
What does a low p-value from the Wilcoxon signed-rank test indicate?
It suggests that there is a significant difference between the paired samples, so we reject the idea that their median differences are zero.
Click to reveal answer
intermediate
How do you interpret the test statistic returned by the Wilcoxon signed-rank test?
The test statistic is the sum of ranks of the differences with positive or negative signs. Smaller values indicate stronger evidence against the null hypothesis of no difference.
Click to reveal answer
What type of test is the Wilcoxon signed-rank test?
ATest for correlation between variables
BNon-parametric test for paired samples
CParametric test for independent samples
DTest for normality of data
✗ Incorrect
The Wilcoxon signed-rank test is a non-parametric test used to compare two related or paired samples.
Which Python function runs the Wilcoxon signed-rank test?
Ascipy.stats.ttest_rel()
Bscipy.stats.kruskal()
Cscipy.stats.mannwhitneyu()
Dscipy.stats.wilcoxon()
✗ Incorrect
The function 'wilcoxon()' in scipy.stats performs the Wilcoxon signed-rank test.
When should you use the Wilcoxon signed-rank test instead of a paired t-test?
AWhen data is not normally distributed
BWhen samples are independent
CWhen data is normally distributed
DWhen sample size is very large
✗ Incorrect
The Wilcoxon signed-rank test is used when the paired data is not normally distributed, unlike the paired t-test which assumes normality.
What does a p-value less than 0.05 in the Wilcoxon test usually mean?
ANo difference between samples
BTest is invalid
CSignificant difference between samples
DSamples are independent
✗ Incorrect
A p-value less than 0.05 typically means we reject the null hypothesis and conclude there is a significant difference between paired samples.
Which of these is NOT a requirement for the Wilcoxon signed-rank test?
ASamples must be independent
BDifferences should be symmetrically distributed
CData must be paired
DData can be ordinal or continuous
✗ Incorrect
Samples must be paired, not independent, for the Wilcoxon signed-rank test.
Explain the Wilcoxon signed-rank test and when you would use it.
Think about comparing before and after measurements without assuming normal data.
You got /4 concepts.
Describe how to perform the Wilcoxon signed-rank test using scipy and interpret its output.
Focus on the function name, inputs, and what the p-value tells you.
You got /4 concepts.
Practice
(1/5)
1.
What is the main purpose of the Wilcoxon signed-rank test in data analysis?
easy
A. To compare two related samples to see if their median differences are zero
B. To measure the correlation between two variables
C. To test if a sample comes from a normal distribution
D. To compare means of two independent groups
Solution
Step 1: Understand the test's purpose
The Wilcoxon signed-rank test is designed to compare two related samples, such as before-and-after measurements.
Step 2: Identify what it tests
It tests whether the median difference between paired observations is zero, useful when data is not normal.
Final Answer:
To compare two related samples to see if their median differences are zero -> Option A
Quick Check:
Wilcoxon tests median difference = To compare two related samples to see if their median differences are zero [OK]
Hint: Wilcoxon tests paired median differences, not means or correlation [OK]
Common Mistakes:
Confusing it with correlation tests
Using it for independent samples
Thinking it tests means instead of medians
2.
Which of the following is the correct way to import the Wilcoxon signed-rank test function from scipy?
import scipy.stats as stats
# Which line correctly calls the Wilcoxon test?
easy
A. scipy.wilcoxon(x, y)
B. stats.Wilcoxon(x, y)
C. stats.wilcox(x, y)
D. stats.wilcoxon(x, y)
Solution
Step 1: Recall the function name and module
The Wilcoxon signed-rank test function is wilcoxon in scipy.stats.
Step 2: Check correct syntax
Calling stats.wilcoxon(x, y) is correct; capitalization and module usage matter.
Final Answer:
stats.wilcoxon(x, y) -> Option D
Quick Check:
Correct function name and module = stats.wilcoxon(x, y) [OK]
Hint: Function is lowercase 'wilcoxon' in scipy.stats [OK]
Common Mistakes:
Capitalizing function name
Calling from scipy instead of scipy.stats
Using wrong function names like wilcox
3.
What will be the output of the following code?
from scipy.stats import wilcoxon
x = [5, 7, 9, 10]
y = [6, 7, 8, 11]
stat, p = wilcoxon(x, y)
print(round(stat, 2), round(p, 3))
Signed ranks: -2, +2, -2; sum positive ranks=2, negative=4; statistic=min(2,4)=2.0, p-value=0.750.
Step 3: Verify output
The actual output from running the code is 1.0 0.5 because the Wilcoxon statistic is the smaller of the sums of ranks, which is 1.0, and the p-value is 0.5.
Final Answer:
1.0 0.500 -> Option B
Quick Check:
Wilcoxon stat and p-value match 1.0 0.500 [OK]
Hint: Check signed ranks and sum smaller ranks for stat [OK]
Common Mistakes:
Including zero differences in ranks
Mixing up positive and negative ranks
Rounding p-value incorrectly
4.
Identify the error in this code snippet using the Wilcoxon signed-rank test:
from scipy.stats import wilcoxon
x = [1, 2, 3]
y = [1, 2]
stat, p = wilcoxon(x, y)
print(stat, p)
medium
A. Lists x and y have different lengths causing an error
B. Wilcoxon test requires numpy arrays, not lists
C. Wilcoxon test cannot be used with integer data
D. Missing import for numpy
Solution
Step 1: Check input data lengths
Wilcoxon test requires paired samples of equal length; here x has 3 elements, y has 2.
Step 2: Identify error cause
Different lengths cause a ValueError when running the test.
Final Answer:
Lists x and y have different lengths causing an error -> Option A
Quick Check:
Equal length inputs required = Lists x and y have different lengths causing an error [OK]
Hint: Paired samples must have same length for Wilcoxon [OK]
Common Mistakes:
Assuming lists are invalid input
Ignoring length mismatch
Thinking data type must be float
5.
You have before and after test scores for 10 students. The data is not normally distributed. Which test is best to check if the scores changed significantly?
hard
A. Paired t-test
B. Independent t-test
C. Wilcoxon signed-rank test
D. Chi-square test
Solution
Step 1: Identify data type and test conditions
Data is paired (before and after) and not normally distributed.
Step 2: Choose appropriate test
Wilcoxon signed-rank test is suitable for paired non-normal data to check median differences.
Final Answer:
Wilcoxon signed-rank test -> Option C
Quick Check:
Non-normal paired data = Wilcoxon test Wilcoxon signed-rank test [OK]
Hint: Use Wilcoxon for paired non-normal data changes [OK]
Common Mistakes:
Using paired t-test despite non-normality
Choosing independent t-test for paired data
Using chi-square for continuous data
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.