ADVERTISEMENT
Google AdSense Slot (headerLeaderboard)
Set your Publisher ID in src/config/ads.ts to display live ads.
Data Science & Statistical Analysis• 6 min read
Correlation vs. Causation & Pearson r
Interpret the Pearson correlation coefficient (-1 to +1) and avoid confusing correlation with causal relationships.
The Pearson Correlation Coefficient (r)
The correlation coefficient r measures the strength and direction of a linear relationship between two variables:
+1.0: Perfect positive linear correlation (as X rises, Y rises proportionally).
0.0: No linear relationship.
-1.0: Perfect negative correlation (as X rises, Y falls proportionally).
Computing Correlation Matrix in Python
import pandas as pd
data = {
'advertising': [100, 200, 300, 400, 500],
'sales': [120, 230, 310, 420, 510],
'complaints': [45, 30, 25, 12, 10]
}
df = pd.DataFrame(data)
print(df.corr())ADVERTISEMENT
Google AdSense Slot (inContentBanner)
Set your Publisher ID in src/config/ads.ts to display live ads.
Test Yourself With Exercise
What does a Pearson correlation coefficient of -0.92 indicate?