R-squared (), also known as the coefficient of determination, is a statistical measure that represents the proportion of the variance for a dependent variable that is explained by an independent variable or variables in a regression model. It ranges from 0 to 1, where higher values indicate a better fit of the model to the data. While commonly used in linear regression, R-squared is applicable to various regression contexts and serves as a key diagnostic for evaluating model performance.

1 Definition and Formula

1.1 Conceptual definition

Conceptually, R-squared quantifies how well the regression model approximates the real data points. It expresses the fraction of the total variation in the dependent variable that is accounted for by the independent variables, with the remaining variation attributed to random error or unobserved factors.

1.2 Mathematical formula

1.2.1 Sum of squares decomposition

The total sum of squares (SSₜₒₜ) is the sum of squared deviations of the dependent variable from its mean, decomposed into the regression sum of squares (SSᵣₑ₉) and the residual sum of squares (SSᵣₑₛ):

SSₜₒₜ = SSᵣₑ₉ + SSᵣₑₛ

R² is then defined as:

R² = SSᵣₑ₉ / SSₜₒₜ = 1 – (SSᵣₑₛ / SSₜₒₜ)

1.2.2 Relationship with correlation coefficient

In simple linear regression (one predictor), R² equals the square of the Pearson correlation coefficient r between the dependent and independent variables: R² = r².

1.3 Alternative formulations

R² can also be expressed using the ratio of the variance of the fitted values to the variance of the observed values, or through the squared correlation between observed and predicted values: R² = [Corr(y, ŷ)]².

2 Interpretation

2.1 Range and meaning

R² values range from 0 to 1 (or 0% to 100%). A value of 0 indicates that the model explains none of the variance; a value of 1 indicates perfect explanation. In practice, values depend on the field of study: for example, R² > 0.9 is common in physics but rare in social sciences.

2.2 R-squared as explained variance

R² is often described as the proportion of variance “explained” by the model. This is a useful shorthand, but strictly it refers to the reduction in variance relative to the mean-only model; it does not imply a causal explanation.

2.3 Perfect fit and zero fit

A perfect fit (R² = 1) occurs when all residuals are zero—every data point lies exactly on the regression line. A zero fit (R² = 0) means the model predicts no better than the sample mean, and the regression line is horizontal at the mean of the dependent variable.

2.4 R-squared in simple vs. multiple regression

In simple linear regression, R² has a direct relationship with the slope and correlation. In multiple regression, R² reflects the combined explanatory power of all predictors, and it will generally increase (or stay the same) as predictors are added, regardless of their relevance.

3 Properties and Assumptions

3.1 Non‑decreasing with additional predictors

Adding any predictor to an ordinary least squares (OLS) model cannot decrease the R²; it will either increase or remain unchanged. This property leads to overfitting if model selection relies solely on R².

3.2 Sensitivity to outliers

Outliers can artificially inflate or deflate R². A single extreme point may increase the denominator SSₜₒₜ while also affecting the residuals, potentially producing a misleadingly high or low value.

3.3 Invariance under linear transformations

R² is invariant under linear transformations of the independent variables (e.g., scaling, centering) and under linear transformations of the dependent variable, as long as the transformation does not affect the proportional variance decomposition.

3.4 Statistical assumptions for valid interpretation

For R² to be a meaningful measure of fit, the underlying regression model should satisfy assumptions such as linearity, independence of errors, homoscedasticity, and normality of residuals. Violations can distort R² and its interpretation.

4 Limitations and Caveats

4.1 Overfitting and misleading high R²

Because R² never decreases with added predictors, it can be driven arbitrarily close to 1 by including many irrelevant variables, especially in small samples. A high R² does not guarantee a good model for prediction.

4.2 R-squared does not imply causation

A high R² indicates only a strong statistical association, not a causal relationship. Confounding variables, reverse causality, or spurious correlations can produce large values without a true causal link.

4.3 Inability to detect model misspecification

R² does not assess whether the functional form is correct (e.g., linear vs. nonlinear) or whether important variables are omitted. A model with a moderate R² may be correctly specified, while a high R² may hide specification errors.

4.4 Comparisons across different datasets

R² values cannot be meaningfully compared across datasets with different variances, sample sizes, or measurement scales. A model may have a lower R² on a more variable dataset but still be superior.

5 Adjusted R-squared

5.1 Need for penalization

To counteract the automatic increase of R² with extra predictors, adjusted R² applies a penalty for each additional term. It only increases if the new predictor improves the model more than would be expected by chance.

5.2 Formula and degrees of freedom correction

Adjusted R² (denoted by R̅² or R²ₐₔ) is computed as:

R²ₐₔ = 1 – (1 – R²) × (n – 1) / (n – k – 1)

where n is the sample size and k is the number of predictors. The term (n – 1)/(n – k – 1) adjusts for degrees of freedom.

5.3 When to use adjusted R²

Adjusted R² is preferred when comparing models with different numbers of predictors, especially during model selection. It helps guard against overfitting and provides a more honest estimate of population fit.

6.1 Coefficient of multiple correlation

The coefficient of multiple correlation R is the square root of R² in multiple regression. It represents the correlation between the observed and predicted values and ranges from 0 to 1.

6.2 Nagelkerke’s R² for logistic regression

For logistic regression (binary outcomes), Nagelkerke’s R² is a pseudo‑R² that scales the Cox & Snell R² to reach a maximum of 1. It provides a measure of model fit analogous to R² in OLS.

6.3 Pseudo‑R² for generalized linear models

Generalized linear models (GLMs) use various pseudo‑R² measures (e.g., McFadden’s, Efron’s) based on likelihood ratios or deviance. These approximate the explained variance concept but do not equal the OLS R².

6.4 Out‑of‑sample R-squared (prediction R²)

Also called prediction R² or validation R², this measure evaluates the model’s performance on new data (e.g., via cross‑validation). It uses mean squared prediction error instead of residual sum of squares and is more reliable for assessing predictive power.

7 Applications in Practice

7.1 Model selection and evaluation

R² and adjusted R² are routinely used to compare competing regression models, though they are often supplemented with information criteria (AIC, BIC) or cross‑validated error.

7.2 Reporting in scientific research

In many disciplines—economics, psychology, ecology—researchers report R² as a standard part of regression output, indicating the explanatory power of the model relative to the total variation.

7.3 Use in exploratory data analysis

During exploratory analysis, R² helps identify which variables or combinations of variables account for most of the variance, guiding further model building.

7.4 Common mistakes and misconceptions

Common errors include: assuming a high R² implies a good predictive model; using R² alone for model selection; interpreting R² as a measure of effect size; and comparing R² across different types of regression models (e.g., linear vs. logistic) without adjustment.