Recall & Review
beginner
What is Spearman correlation?
Spearman correlation measures how well the relationship between two variables can be described using a monotonic function. It uses ranks instead of actual values.
Click to reveal answer
beginner
How does Spearman correlation differ from Pearson correlation?
Spearman correlation uses ranks and measures monotonic relationships, while Pearson correlation uses actual values and measures linear relationships.
Click to reveal answer
beginner
Which Python library and function can you use to calculate Spearman correlation?
You can use the scipy library and the function scipy.stats.spearmanr to calculate Spearman correlation.
Click to reveal answer
intermediate
What does the output of scipy.stats.spearmanr include?
It returns two values: the Spearman correlation coefficient (a number between -1 and 1) and the p-value that tests if the correlation is significant.
Click to reveal answer
intermediate
Why is Spearman correlation useful with non-linear data?
Because it uses ranks, Spearman correlation can detect monotonic relationships even if they are not straight lines, unlike Pearson correlation.
Click to reveal answer
What type of relationship does Spearman correlation measure?
✗ Incorrect
Spearman correlation measures monotonic relationships, which means variables move in the same direction but not necessarily at a constant rate.
Which function calculates Spearman correlation in scipy?
✗ Incorrect
The function scipy.stats.spearmanr calculates Spearman correlation.
What does a Spearman correlation coefficient of 1 mean?
✗ Incorrect
A coefficient of 1 means a perfect positive monotonic relationship between variables.
Why might you choose Spearman over Pearson correlation?
✗ Incorrect
Spearman is better when data is not linear or has outliers because it uses ranks.
What does the p-value from scipy.stats.spearmanr indicate?
✗ Incorrect
The p-value tests if the observed correlation is statistically significant or could happen by chance.
Explain how to calculate and interpret Spearman correlation using scipy.
Think about ranking data and what the two outputs mean.
You got /5 concepts.
Describe when and why you would use Spearman correlation instead of Pearson correlation.
Consider the shape of data and sensitivity to outliers.
You got /5 concepts.