R-Squared Visualizer
Regression Equation
Model Fit
Select a preset dataset to load it into the visualizer. Each dataset demonstrates a different R² range and real-world context.
Dataset Examples
Click any example to load it into the visualizer above. Each shows a different R² range and real-world context.
What Is R-Squared (R²)?
R-squared (R²), also called the coefficient of determination, is a statistical measure that tells you what proportion of the variance in the dependent variable is explained by the independent variable(s) in a regression model. It ranges from 0 to 1. An R² of 0 means the model explains nothing; an R² of 1 means it explains everything perfectly. If your regression model has an R² of 0.85, it means 85% of the variation in y is accounted for by the model, and the remaining 15% is left unexplained.
First formalized by statistician Karl Pearson in the early 20th century, R² builds on the least-squares regression work of Francis Galton and Ronald Fisher. Today it appears in virtually every regression output — from Python's scikit-learn and R's lm() summary to Excel's LINEST function and SPSS output tables. Understanding what R² actually measures — and what it does not — separates competent data analysis from naive number-reading.
How R² Is Calculated: SST, SSR, and SSE
Regression decomposes the total variability in y into two parts: the part the model explains, and the part it does not.
How to Interpret R² Values
R² vs Adjusted R²
Standard R² has a known problem: it always increases when you add more predictors to a multiple regression model, even if those predictors are pure noise. Adjusted R² corrects for this by penalizing model complexity. It is the right metric to report in multiple regression.
| Metric | Formula | Range | When to use |
|---|---|---|---|
| R² | 1 − SSE/SST | 0 to 1 | Simple linear regression with one predictor |
| Adjusted R² | 1 − (1−R²)·(n−1)/(n−k−1) | Can be negative | Multiple regression — always prefer this over R² |
| r (Pearson correlation) | SSR^0.5 / SST^0.5 | −1 to +1 | Bivariate relationship strength and direction |
| RMSE | √(SSE / n) | 0 to ∞ | Prediction error in original units; model comparison |
| MSE | SSE / (n − 2) | 0 to ∞ | Unbiased variance estimate; hypothesis testing in regression |
Common Misinterpretations of R²
R² in Machine Learning
In machine learning, R² appears as a standard regression metric alongside RMSE and MAE. Scikit-learn's r2_score() function computes it on test set predictions. Unlike in classical statistics where R² is computed on training data, machine learning practice typically reports R² on a validation or test set. A model with training R² of 0.95 and test R² of 0.45 is clearly overfitting. The bias-variance tradeoff is the underlying reason for this gap.
R² Across Different Fields: Typical Benchmarks
| Field | Typical R² range | Interpretation |
|---|---|---|
| Physics / Engineering | 0.95–1.00 | High determinism; measurement error is the main noise source |
| Economics / Macroeconomics | 0.50–0.90 | Economic variables are highly correlated over time |
| Applied econometrics (cross-section) | 0.10–0.50 | Individual-level variation is substantial |
| Psychology / Behavioral science | 0.05–0.40 | Human behavior has many unmeasured determinants |
| Financial returns (daily) | 0.001–0.10 | Markets are near-efficient; small R² can still be profitable |
| Healthcare outcomes | 0.20–0.60 | Biological variability and lifestyle factors are substantial |
| Educational testing | 0.30–0.70 | Study time, socioeconomic factors, and ability all contribute |
Entity Glossary
| Term | Symbol | Definition |
|---|---|---|
| R-Squared / Coefficient of Determination | R² | Proportion of variance in y explained by the model. R² = 1 − SSE/SST |
| Adjusted R-Squared | R²adj | R² penalized for number of predictors. Preferred in multiple regression |
| Regression Line | ŷ = β₀ + β₁x | Least-squares line minimizing SSE; the predicted value of y at each x |
| Residual | eᵢ = yᵢ − ŷᵢ | Vertical distance between each observed point and the regression line |
| Total Sum of Squares | SST | Σ(yᵢ − ȳ)² — total variability in y around its mean |
| Regression Sum of Squares | SSR | Σ(ŷᵢ − ȳ)² — variance in y explained by the model |
| Sum of Squared Errors | SSE | Σ(yᵢ − ŷᵢ)² — residual variance; unexplained portion |
| Pearson Correlation Coefficient | r | Measures linear relationship strength and direction; r² = R² in simple regression |
| Standard Error of the Estimate | Sₑ | Typical distance of observed points from the regression line |
| RMSE | RMSE | Root mean squared error; √(SSE/n). In original y units |
Related Topics
Sources & further reading:
- James, G., Witten, D., Hastie, T., & Tibshirani, R. (2021). An Introduction to Statistical Learning (2nd ed.). Springer. — statlearning.com
- NIST Engineering Statistics Handbook — Measures of Fit in Simple Linear Regression
- Penn State STAT 501: Regression Methods — The Coefficient of Determination, R-Squared
- Scikit-learn documentation — r2_score
- Anscombe, F. J. (1973). Graphs in Statistical Analysis. The American Statistician, 27(1), 17–21. [Origin of Anscombe's Quartet]
Frequently Asked Questions
An R² of 0.75 means the regression model explains 75% of the variance in the dependent variable. The remaining 25% is accounted for by factors not included in the model — measurement error, omitted variables, or inherent randomness. In most applied fields, R² = 0.75 represents a reasonably strong model. Whether it is "good enough" depends on the field: 0.75 is mediocre in physics but excellent in behavioral science.
No. R² can be artificially inflated by adding more predictors (even irrelevant ones), by overfitting training data, or by studying data where variables are highly correlated by construction (like time-series data with trends). A model with R² = 0.99 on training data that drops to R² = 0.40 on test data is a poor predictive model. Always complement R² with residual plots, cross-validation, adjusted R², and domain judgment.
Standard R² always increases (or stays the same) when you add predictors to a multiple regression model, even if those predictors have no real relationship with y. Adjusted R² corrects for this by penalizing the number of predictors: R²adj = 1 − (1 − R²) · (n − 1) / (n − k − 1), where k is the number of predictors. If adding a variable does not improve the model enough to justify the complexity cost, adjusted R² will decrease. In multiple regression, always report adjusted R².
In standard ordinary least-squares regression, R² is always between 0 and 1. However, R² computed as 1 − SSE/SST can be negative in specific situations: when the model is applied to out-of-sample data it was not trained on, when the intercept is suppressed (regression forced through the origin), or when a non-linear model is evaluated using the linear R² formula. A negative R² means the model's predictions are worse than simply always predicting the mean — the model has negative predictive value.
In real estate hedonic pricing models, R² of 0.65–0.85 is typical for models using predictors like square footage, number of bedrooms, location, and age of the property. A simple model using only house size might achieve R² of 0.50–0.60. Adding location-based variables (school district quality, walkability scores, proximity to amenities) typically pushes R² toward 0.75–0.85. Models below 0.50 with basic predictors available suggest missing important variables or data quality issues.
Outliers can dramatically change R². A single extreme point far from the regression line inflates SSE, which decreases R². Conversely, an influential point that lies far from the mean of x but close to the regression line can artificially inflate R² by "pulling" the line toward itself. This is why residual plots and influence measures (Cook's distance, leverage, DFFITS) are essential companions to R². Try dragging a point to an extreme position in the visualizer above — you will see R² drop immediately.
In multiple regression with k predictors, R² still equals 1 − SSE/SST and measures the proportion of variance in y explained by all k predictors together. The interpretation is the same as in simple regression, but two additional issues arise. First, R² will never decrease when adding predictors, so use adjusted R² for model comparison. Second, individual predictor contributions cannot be read from R² — you need standardized coefficients or relative importance analysis to understand each variable's role. Learn more in our Multiple Linear Regression guide.
R² summarizes model fit in one number, but it can mask serious problems. Always inspect residual plots: if residuals show a systematic curve (not random scatter around zero), linearity is violated — the relationship is non-linear. If residuals fan out as x increases, heteroscedasticity is present and standard errors are wrong. If residuals follow a wave pattern, autocorrelation exists (common in time series). A residual plot that looks like random horizontal noise around zero is what you want — it confirms the regression assumptions hold. The toggle-able residual lines in this visualizer let you develop that visual intuition.