There are no items in your cart
Add More
Add More
Item Details | Price |
---|
Understanding Statistical Relationships Through Real-World Applications
January 7, 2025
r = Σ((x - μx)(y - μy)) / (σx σy)
GDP vs. Employment Rate
Blood Pressure vs. Age
Temperature vs. Ice Cream Sales
ρ = 1 - (6Σd²) / (n(n² - 1))
Study Time vs. Test Rankings
Player Ranking vs. Salary
Service Quality vs. Customer Loyalty
Scenario | Best Choice |
---|---|
Linear relationship expected | Pearson |
Ranked data | Spearman |
Outliers present | Spearman |
Non-normal distribution | Spearman |
Sample implementation:
import numpy as np from scipy import stats import pandas as pd # Sample data x = np.array([1, 2, 3, 4, 5]) y = np.array([2, 4, 5, 4, 5]) # Pearson correlation pearson_corr, _ = stats.pearsonr(x, y) print(f"Pearson correlation: {pearson_corr:.2f}") # Spearman correlation spearman_corr, _ = stats.spearmanr(x, y) print(f"Spearman correlation: {spearman_corr:.2f}")