🔬  R² (R-squared)

R² (R-squared)#

The share of variance in the target explained by a regression model.

Important

✨ AI-generated content. This page was written with the assistance of an AI language model and is provided as a learning aid. Despite careful review, it may still contain mistakes, omissions, or out-of-date information. Whether you are new to the topic, a team lead, or a senior practitioner, treat it as a starting point rather than an authoritative reference: read it critically and independently verify anything you act on (code, commands, figures, and factual claims) against official documentation and primary sources before relying on it.

What it is#

, the coefficient of determination, is the proportion of variance in the target that the model explains. It compares the model’s residual error to the variance around the mean:

\[R^2 = 1 - \frac{SS_{\text{res}}}{SS_{\text{tot}}}, \qquad SS_{\text{res}} = \sum_i (y_i - \hat{y}_i)^2, \quad SS_{\text{tot}} = \sum_i (y_i - \bar{y})^2.\]

How to read it#

It usually runs 0 to 11 is a perfect fit, 0 means the model does no better than predicting the mean (and it can go negative for a model worse than that). Being dimensionless, it complements MAE / RMSE, which report error in the target’s units; in simple regression it equals \(r^2\), the squared Pearson correlation.

Caveats#

never decreases when predictors are added (even noise), so use adjusted R² to compare models of different size; it is sensitive to outliers, assumes the modeled relationship, and a high value implies neither causation nor good out-of-sample performance.


Theme: Model Evaluation & Uncertainty  ·  All terminology



See also

Source article Adapted (context, re-expressed) in our own words from: R² (R-squared) (insightful-data-lab.com).

Tags: purpose: reference topic: terminology level: intermediate