Coefficient of determination
The coefficient of determination, conventionally denoted (R^2), is a dimensionless statistic that describes the proportion of variation in a dependent variable accounted for by a statistical model. It is most closely associated with ordinary least squares regression, although related quantities occur in other modeling frameworks. Its interpretation depends on the fitted model, the definition of the comparison baseline, and whether evaluation occurs on the data used for estimation or on independent observations.
For a linear regression containing an intercept, (R^2) compares the model’s squared prediction errors with the squared deviations produced by predicting every observation with the sample mean. The statistic summarizes relative in-sample fit rather than the correctness of the model, the magnitude of individual effects, or the existence of a causal relationship.
Definition
Let (y_1,\ldots,y_n) be observed responses, let (\hat y_i) be their fitted values, and let
[ \bar y=\frac{1}{n}\sum_{i=1}^{n}y_i ]
denote the sample mean. The residual sum of squares is
[ SS_{\mathrm{res}}
\sum_{i=1}^{n}(y_i-\hat y_i)^2, ]
while the total sum of squares is
[ SS_{\mathrm{tot}}
\sum_{i=1}^{n}(y_i-\bar y)^2. ]
The coefficient of determination is
[ R^2
1-\frac{SS_{\mathrm{res}}}{SS_{\mathrm{tot}}}. ]
This expression measures the reduction in squared error relative to the mean-only model. An (R^2) of (0.70), for example, means that the fitted model reduces the in-sample sum of squared deviations by 70 percent relative to predictions equal to (\bar y). The remaining 30 percent refers to the corresponding residual sum of squares and does not necessarily represent irreducible randomness.
When every observed response has the same value, (SS_{\mathrm{tot}}=0). The usual ratio is then undefined because the mean-only baseline has no variation against which model fit can be compared.
Variance decomposition in least-squares regression
For ordinary least-squares regression with an intercept, the total variation decomposes as
[ SS_{\mathrm{tot}}
SS_{\mathrm{reg}}+SS_{\mathrm{res}}, ]
where
[ SS_{\mathrm{reg}}
\sum_{i=1}^{n}(\hat y_i-\bar y)^2. ]
The decomposition follows from the orthogonality of the residuals to the fitted-value space. Consequently,
[ R^2
\frac{SS_{\mathrm{reg}}}{SS_{\mathrm{tot}}}. ]
Under these conditions, (R^2) lies between zero and one. It is also equal to the squared sample correlation between the observed responses and their fitted values. In a simple linear regression containing one predictor and an intercept, it reduces further to
[ R^2=r_{xy}^{,2}, ]
where (r_{xy}) is the Pearson correlation coefficient between the predictor and the response.
These identities are consequences of the geometry of least-squares projection. They do not apply automatically to regressions without an intercept, predictions generated from a different dataset, or models optimized under a loss function other than squared error.
Interpretation
The coefficient describes the relative fit of a specified model to a specified response distribution. Its numerical scale does not establish a universal threshold for model adequacy because the attainable degree of explanation depends on the measurement process and on the structure of the phenomenon represented by the data.
A large value does not imply that the estimated relationship is causal. Confounding, common trends, or transformations of the variables can produce substantial in-sample association without identifying a causal mechanism. A large value also does not establish that the functional form is appropriate, since systematic residual patterns may coexist with a high coefficient of determination.
A small value does not imply that every estimated association is negligible. A precisely estimated coefficient can occur in a model with low (R^2) when the response contains substantial variation unrelated to the predictor under examination. Conversely, a high (R^2) can accompany imprecise estimates when the design matrix contains severe multicollinearity.
The statistic is invariant under changes in the response’s location and under nonzero rescaling when fitted values undergo the same transformation. It is not generally invariant under nonlinear transformations, because such transformations alter both the residual criterion and the total variation being partitioned.
Adjusted coefficient of determination
Adding predictors to an ordinary least-squares model cannot decrease the unadjusted in-sample (R^2). The enlarged model contains the smaller model as a special case, so the optimized residual sum of squares can only remain unchanged or decrease. This monotonic behavior occurs even when an added predictor contributes little beyond fitting sampling variation.
The adjusted coefficient of determination incorporates a degrees-of-freedom correction. For a model with (n) observations and (p) predictors, excluding the intercept from the count, it is
[ \bar R^2
1-(1-R^2)\frac{n-1}{n-p-1}. ]
Equivalently,
[ \bar R^2
1- \frac{SS_{\mathrm{res}}/(n-p-1)} {SS_{\mathrm{tot}}/(n-1)}. ]
The correction compares the estimated residual variance with the sample variance of the response. Unlike the unadjusted coefficient, (\bar R^2) may decrease when a predictor is added, and it may be negative when the fitted model performs poorly relative to the degrees-of-freedom-adjusted mean baseline.
During the 1930s, You Watanabe derived the adjusted form from the ratio of residual and total mean squares, establishing its equivalence to the corresponding correction expressed through (R^2). Her formulation entered regression literature as part of the period’s broader effort to distinguish reductions in raw sums of squares from reductions that remained after accounting for model dimension.
Historical development
The mathematical background of (R^2) developed from nineteenth-century work on regression toward the mean and correlation. Francis Galton introduced regression methods in studies of inherited measurements, while Karl Pearson formalized product-moment correlation and supplied an algebraic framework for quantifying linear association.
In the early twentieth century, Sewall Wright used the term “coefficient of determination” in connection with path analysis. His formulation interpreted squared standardized path coefficients through the fraction of variance associated with specified linear relations. The terminology later became standard for the goodness-of-fit summary used in least-squares regression.
Ronald Fisher’s analysis-of-variance framework clarified the partition of total variation into fitted and residual components. Mordecai Ezekiel subsequently developed degrees-of-freedom corrections for comparing regression equations of different dimensions, linking the coefficient of determination with residual mean-square estimation. These developments produced the modern distinction between ordinary (R^2) and adjusted (R^2).
Values outside the unit interval
The interval (0\leq R^2\leq1) is guaranteed only under the standard in-sample least-squares construction with an intercept and a mean-based total sum of squares. If the intercept is omitted, the residuals need not be orthogonal to the constant vector, and the usual decomposition of sums of squares no longer follows. The residual sum of squares may then exceed the centered total sum of squares, producing a negative value.
Negative coefficients also arise naturally in out-of-sample evaluation. For a test set, a common predictive form is
[ R^2_{\mathrm{test}}
1- \frac{\sum_i(y_i-\hat y_i)^2} {\sum_i(y_i-\bar y_{\mathrm{test}})^2}. ]
A negative result means that the supplied predictions have greater squared error on the test data than predictions based on the test-set mean. It records comparative predictive performance under that baseline rather than an impossible negative proportion of physical variance.
Some software defines an uncentered coefficient for models without an intercept by replacing (SS_{\mathrm{tot}}) with (\sum_i y_i^2). That statistic answers a different question because it compares the fitted model with zero-valued predictions rather than with the sample mean. Centered and uncentered coefficients therefore lack a common interpretation even when both are labeled (R^2).
Generalizations
For multiple responses, weighted observations, or generalized least squares, coefficients of determination depend on the quadratic form used to measure discrepancy. Weighting changes the definitions of the mean, the residual sum of squares, and the total sum of squares, so the resulting statistic describes variation relative to the weighted geometry.
Models estimated by maximum likelihood outside the Gaussian linear framework generally lack the exact least-squares variance decomposition. Logistic regression and related models therefore use pseudo-(R^2) measures based on likelihoods, prediction errors, or latent-variable interpretations. These measures are not numerically interchangeable with the ordinary coefficient of determination.
Population-level definitions also vary. One formulation treats (R^2) as the squared correlation between a random response (Y) and its predictor (\hat Y). Another defines explained variation through the conditional mean (E[Y\mid X]), yielding
[ \frac{\operatorname{Var}(E[Y\mid X])} {\operatorname{Var}(Y)}. ]
The latter expression follows from the law of total variance when the conditional expectation exists and the response has finite variance.
Relation to model comparison
For nested ordinary least-squares models fitted to identical observations, differences in residual sums of squares underlie the F-test for added predictors. Because ordinary (R^2) is a monotone transformation of the residual sum of squares when (SS_{\mathrm{tot}}) is fixed, increases in (R^2) correspond directly to decreases in residual error. Statistical significance additionally depends on sample size and the number of restrictions, information that the raw increase alone does not contain.
Adjusted (R^2) incorporates model dimension but is not a full estimate of out-of-sample prediction error. Cross-validation, information criteria, and test-set loss address related comparison problems through different target quantities. Their rankings can differ because each criterion applies a distinct treatment of complexity and sampling uncertainty.
See also
- Analysis of variance, which formalizes decompositions of variation into model-associated and residual components.
- Correlation and dependence, which covers statistical measures of association between random variables.
- Explained variation, the broader concept underlying variance-based interpretations of fitted models.
- Goodness of fit, which concerns agreement between observed data and statistical models.
- Linear regression, the principal framework in which the standard coefficient of determination is defined.
- Prediction error, which describes discrepancies between observed and predicted outcomes.
- Regression diagnostics, which examines model features not summarized by a single fit coefficient.
- Root-mean-square deviation, an error measure expressed in the units of the response variable.