AI summary by TwinMind
R-squared, Clearly Explained!!!
StatQuest with Josh Starmer
11m 1s
Introduction to R-Squared
- R-squared: correlation metric, easy to compute, intuitive to interpret
- Comparison with plain old R correlation:
- R values close to 1 or -1 = strong correlation
- R values close to 0 = weak correlation
- Why R-squared preferred over regular R:
- Easier interpretation
- Example: R = 0.7 vs R = 0.5 relationship not obvious
- R-squared = 0.7 is 1.4x better than R-squared = 0.5
Basic Concept with Mouse Weight Example
- Dataset: mouse weight (y-axis) vs mouse ID numbers 1-7 (x-axis)
- Calculate mean/average of mouse weights as horizontal line
- Variation around mean = sum of squared differences between each data point and mean
- Squaring prevents negative values canceling positive values
Reordering Data by Size
- Reorder mice by size instead of ID number
- X-axis: mouse size (smallest to largest)
- Mean and variation remain exactly same
- Only order of dots changed, distances to mean line unchanged
Fitting a Line vs Using Mean
- Question: Is mean weight best predictor for individual mouse weight given size?
- Answer: No, can do better by fitting line to data
- Blue line allows better weight prediction based on size
- Visual assessment: blue line fits data better than mean
R-Squared Calculation Formula
- R² = (Variation around mean - Variation around line) / Variation around mean
- Components:
- Variation around mean: sum of squared differences from mean
- Variation around line: sum of squared differences from fitted line
- Range: 0 to 1 (variation around line never > variation around mean)
- Result expressed as percentage
Detailed Calculation Example
- Variation around mean = 32
- Variation around blue line = 6
- R² = (32 - 6) / 32 = 26/32 = 0.81 = 81%
- Interpretation: 81% less variation around line than mean
- Size-weight relationship accounts for 81% of total variation
- Most variation explained by size-weight relationship
Poor Correlation Example
- Y-axis: mouse weight
- X-axis: time spent sniffing rock
- Variation around mean = 32 (same as before)
- Variation around blue line = 30 (much larger)
- R² = (32 - 30) / 32 = 2/32 = 0.06 = 6%
- Only 6% of variation explained by sniff-weight relationship
Practical Interpretation Guidelines
- R² = 0.9: "Very good" - relationship explains 90% of variation
- R² = 0.01: "Who cares" - only 1% of variation explained, 99% from other factors
Relationship Between R and R-Squared
- R-squared = R²
- Examples:
- R = 0.9 → R² = 0.81 = 81% variation explained
- R = 0.5 → R² = 0.25 = 25% variation explained
Comparative Analysis
- R = 0.7 vs R = 0.5 comparison:
- R² = 0.7² = 0.49 = 49% variation explained
- R² = 0.5² = 0.25 = 25% variation explained
- First correlation 2x better (49% vs 25%)
- R-squared makes comparison intuitive
Limitations and Considerations
- R-squared doesn't indicate correlation direction (always positive)
- If direction unclear, specify "positively or negatively correlated with R² = X"
- Squared numbers never negative
Key Takeaways
- R-squared = percentage of variation explained by relationship between variables
- Convert plain R to R-squared by squaring for better understanding
- Two main concepts:
- Percentage of variation explained
- Square any given R value for clearer interpretation
