Centered R² vs Uncentered R²

Version 21 | Created: 2026-04-25 | Updated: 2026-11-07 13:46 UTC
- 1. Introduction: R² and Its Relation to RSQ
- 2. Comparison of the Two Formulas
- 3. Pros and Cons
- 4. Applications
- 5. Derivation of Uncentered R²
- 6. Geometric Interpretation
- References
- Appendix A. Terminology
- Appendix B. Python Code
The coefficient of determination, denoted as R² (R-squared), is one of the most
widely used validation metrics in statistics and machine learning (ML) for
assessing how well predicted values RSQ()), which computes the
squared Pearson correlation coefficient between two variables. The default RSQ
in Excel and the standard R² reported by most regression libraries refer to the
same quantity: the centered R², which measures the proportion of variance in
However, a less commonly discussed variant — the uncentered R² — replaces
the mean-based baseline with a zero baseline. This article compares the two,
derives the uncentered formula, provides a geometric interpretation, and
discusses when each is appropriate, with the Python implementations collected in
Appendix B. In particular, we examine whether
uncentered R² is more suitable for evaluating 1:1-line agreement between
- The difference lies entirely in the denominator. Centered R² asks "how much variance around the mean has been explained?", whereas uncentered R² asks "how much of the total sum of squares around zero has been explained?". Centered R² uses the mean prediction as its baseline, while uncentered R² uses zero prediction as its baseline [3].
- Centered R² asks: "How much better is the model compared to a baseline that simply predicts the mean?"
- Uncentered R² asks: "How close is the model's prediction to the 1:1 identity line (y=x)?"
- Pros: Scale- and unit-invariant, allowing comparison of models across different physical quantities. Equivalent to the squared Pearson correlation coefficient, providing rich statistical intuition.
-
Cons: When the variance of
$y$ is small (nearly constant), the denominator approaches zero and R² collapses or even turns negative. Measures only relative performance against a mean predictor and is insensitive to systematic bias.
- Pros: When comparing models, datasets, or experiments at the same physical-quantity level, uncentered R² provides a consistent absolute baseline (zero prediction), enabling coherent cross-comparison. Robust against low-variance data. Sensitive to deviations from the 1:1 line, properly penalizing systematic bias [4].
-
Cons: Scale-dependent, so unsuitable for comparing models across different
units or value ranges. When
$\bar{y}$ is large,$R^2_u$ tends to be artificially close to 1. Uncentered$R^2$ values tend to be significantly higher (often reaching 0.99 or above) because the denominator,$\sum y_i^2$ , is generally much larger than the centered denominator,$\sum (y_i - \bar{y})^2$ . This can lead to an overly optimistic assessment if interpreted in isolation. However, for min-max normalized data, the uniformity of scale renders the uncentered$R^2$ a superior metric for quantifying the absolute agreement between observed and predicted values.
Key question: When comparing models on data of the same physical quantity,
is uncentered R² actually more accurate? The answer is essentially "yes." For
evaluating absolute agreement between
- Standard performance metric in general regression and ML modeling.
- Comparing model performance across heterogeneous units or domains in normalized form.
- Variance-explanation evaluation based on Pearson correlation [1].
-
Regression Through the Origin (RTO): Models physically constrained to pass
through zero, such as Hooke's law and radioactive decay. The
noconstantoption in Stata, R, and EViews automatically returns uncentered R² [2]. When the intercept is fixed to zero, standard (centered)$R^2$ can produce negative values or misleading interpretations. In such cases, uncentered$R^2$ is used as a robust alternative to evaluate the model's fit relative to the origin. -
Diagnostic tests in econometrics: Auxiliary regressions in the
Breusch-Pagan and White tests use
$nR^2$ as a chi-squared statistic, computed in uncentered form [6]. -
Evaluating deviation from the 1:1 line in
$Y_{true}$ vs$Y_{pred}$ plots: For ML prediction tasks involving same-physical-quantity data, uncentered R² measures absolute agreement. Suitable for calibration, Computational Fluid Dynamics (CFD) and Finite Element Method (FEM) validation, sensor calibration, and reproducibility studies.
For observations
From the OLS normal equations
The fitted-value vector and the residual vector are orthogonal. This holds regardless of whether the model includes an intercept.
Squaring
The cross term vanishes by orthogonality
Dividing both sides by
Definition: Uncentered R²
Uncentered R² is the ratio of the sum of squares explained by the model,$ESS_u$ , to the total sum of squares around zero,$TSS_u$ .
Since
When
Treating the
Let
Since
y
/|
/ |
/ | e (perpendicular residual)
/ |
/____|
origin ŷ (on the C(X) plane)
This is the geometric identity behind
where
Subtracting the mean vector
where
y
/|
/ |
/ |
/ | e
/ |
/ |
*------ŷ-----→ (C(X) plane)
origin
/
*────────── 1 direction (constant vector)
ȳ·1
-
Uncentered R²: angle between
$\mathbf{y}$ and$\hat{\mathbf{y}}$ measured from the origin. -
Centered R²: angle measured after shifting the reference point to
$\bar{y}\cdot\mathbf{1}$ .
The fundamental distinction is whether the reference point is the origin or the mean vector. The same data, viewed from different reference points, yields different angles between the two vectors.
Table 1. Geometric distinction between uncentered and centered R²
| Aspect | Uncentered | Centered |
|---|---|---|
| Reference point | Origin 0 | Mean vector ȳ·1 |
| Right triangle | y, ŷ, e | ỹ, ŷ̃, e |
| Angle interpretation | cos²(∠yŷ) | cos²(∠ỹŷ̃) = r² |
| Required condition | e ⊥ ŷ | e ⊥ ŷ and 1 ∈ C(X) |
| Sensitivity to bias | Sensitive (origin-fixed) | Insensitive (mean-shift invariant) |
Geometric meaning of 1:1-line validation: Under a constant bias
[1] Draper, N. R., & Smith, H. (1998). Applied Regression Analysis (3rd ed.). Wiley.
[2] Eisenhauer, J. G. (2003). Regression through the origin. Teaching Statistics, 25(3), 76–80.
[3] Kvalseth, T. O. (1985). Cautionary note about R². The American Statistician, 39(4), 279–285.
[4] Legates, D. R., & McCabe, G. J. (1999). Evaluating the use of "goodness-of-fit" measures in hydrologic and hydroclimatic model validation. Water Resources Research, 35(1), 233–241.
[5] Strang, G. (2009). Introduction to Linear Algebra (4th ed.). Wellesley-Cambridge Press. ISBN 978-0-9802327-1-4.
[6] Wooldridge, J. M. (2010). Econometric Analysis of Cross Section and Panel Data (2nd ed.). MIT Press. ISBN 978-0-262-23258-6.
- centered R²: the standard R², whose denominator is the sum of squares about the mean of the data.
- CFD: Computational Fluid Dynamics, the numerical simulation of fluid flow.
-
ESS: Explained Sum of Squares. In uncentered form,
$\sum \hat{y}_i^2$ . - FEM: Finite Element Method, the numerical solution of field problems on a discretized domain.
- MAE: Mean Absolute Error, the mean of the absolute residuals.
- MAPE: Mean Absolute Percentage Error, the mean absolute residual expressed as a percentage of the observation. Undefined where an observation is zero.
- OLS: Ordinary Least Squares, the estimator that minimizes the sum of squared residuals.
- RMSE: Root Mean Squared Error, the square root of the mean squared residual.
- RSQ: the Excel function name for the squared Pearson correlation coefficient, which equals the centered R².
-
RSS: Residual Sum of Squares,
$\sum e_i^2$ . - RTO: Regression Through the Origin, a regression whose intercept is fixed to zero.
-
TSS: Total Sum of Squares. In uncentered form,
$\sum y_i^2$ ; in centered form,$\sum (y_i - \bar{y})^2$ . - uncentered R²: the R² whose denominator is the sum of squares about zero rather than about the mean.
import numpy as np
def centered_r2(y_true, y_pred):
"""
Centered R² (standard R²)
R²_c = 1 - SSE / SST_centered
"""
y_true = np.asarray(y_true, dtype=float)
y_pred = np.asarray(y_pred, dtype=float)
sse = np.sum((y_true - y_pred) ** 2)
sst_c = np.sum((y_true - np.mean(y_true)) ** 2)
if sst_c == 0:
return np.nan # undefined when y has zero variance
return 1.0 - sse / sst_c
# Example usage
y_true = np.array([10.1, 10.2, 10.3, 10.4, 10.5])
y_pred = np.array([10.0, 10.3, 10.2, 10.5, 10.4])
print(f"Centered R²: {centered_r2(y_true, y_pred):.6f}")
# Confirm equivalence with scikit-learn
from sklearn.metrics import r2_score
print(f"sklearn r2: {r2_score(y_true, y_pred):.6f}")def uncentered_r2(y_true, y_pred):
"""
Uncentered R² (origin-based R²)
R²_u = 1 - SSE / SST_uncentered
= ⟨ŷ, ŷ⟩ / ⟨y, y⟩ (when e ⊥ ŷ)
"""
y_true = np.asarray(y_true, dtype=float)
y_pred = np.asarray(y_pred, dtype=float)
sse = np.sum((y_true - y_pred) ** 2)
sst_u = np.sum(y_true ** 2)
if sst_u == 0:
return np.nan
return 1.0 - sse / sst_u
# Example usage — comparing predictions on a same-physical-quantity scale (e.g., voltage)
y_true = np.array([10.1, 10.2, 10.3, 10.4, 10.5])
y_pred = np.array([10.0, 10.3, 10.2, 10.5, 10.4])
print(f"Uncentered R²: {uncentered_r2(y_true, y_pred):.6f}")
# Constant-bias scenario: contrast between the two metrics
y_pred_biased = y_true + 0.5 # all predictions offset by +0.5
print(f"\nConstant bias +0.5 scenario:")
print(f" Centered R²: {centered_r2(y_true, y_pred_biased):.6f} "
f"(insensitive to bias)")
print(f" Uncentered R²: {uncentered_r2(y_true, y_pred_biased):.6f} "
f"(sensitive to bias)")def evaluate_1_to_1_line_agreement(y_true, y_pred):
"""Evaluate 1:1-line agreement on same-physical-quantity data."""
y_true = np.asarray(y_true, dtype=float)
y_pred = np.asarray(y_pred, dtype=float)
err = y_pred - y_true
rmse = np.sqrt(np.mean(err ** 2))
mae = np.mean(np.abs(err)) # Mean Absolute Error
bias = np.mean(err) # Mean Error (systematic bias)
# MAPE: Mean Absolute Percentage Error (%) — undefined when y_true contains 0
mask = y_true != 0
if mask.any():
mape = np.mean(np.abs(err[mask] / y_true[mask])) * 100.0
else:
mape = np.nan
return {
"CenteredR2": centered_r2(y_true, y_pred),
"UncenteredR2": uncentered_r2(y_true, y_pred),
"RMSE": rmse,
"MAE": mae,
"MAPE": mape,
"Bias": bias,
}
# Example usage
y_true = np.array([10.1, 10.2, 10.3, 10.4, 10.5])
y_pred = np.array([10.0, 10.3, 10.2, 10.5, 10.4])
results = evaluate_1_to_1_line_agreement(y_true, y_pred)
for k, v in results.items():
print(f"{k:>15s}: {v:.6f}")Version 9 | Created: 2026-09-05 | Updated: 2026-11-07 13:46 UTC
- 1. Introduction: R² and Its Relation to RSQ
- 2. Comparison of the Two Formulas
- 3. Pros and Cons
- 4. Applications
- 5. Derivation of Uncentered R²
- 6. Geometric Interpretation
- References
- Appendix A. Terminology
- Appendix B. Python Code
결정계수 (coefficient of determination), 곧 R² 는 예측값 RSQ()) 로 불리며,
이는 두 변수 사이의 Pearson 상관계수를 제곱한 값을 계산한다. Excel 의 기본 RSQ 와
대부분의 회귀 library 가 내놓는 표준 R² 는 같은 양, 곧 centered R² 를
가리키며, 이는
그런데 덜 다루어지는 변형인 uncentered R² 는 평균 기준의 baseline 을 0 기준의
baseline 으로 바꾼다. 이 글은 둘을 견주고, uncentered 식을 유도하고, 기하학적
해석을 주고, 각각이 언제 알맞은지를 다루며, Python 구현은
Appendix B 에 모았다. 특히 같은 물리량끼리 견주는
자리에서
- 차이는 온전히 분모에 있다. Centered R² 는 "평균 둘레의 변동을 얼마나 설명했는가" 를 묻고, uncentered R² 는 "0 둘레의 전체 제곱합을 얼마나 설명했는가" 를 묻는다. Centered R² 는 평균 예측을 baseline 으로 삼고, uncentered R² 는 0 예측을 baseline 으로 삼는다 [3].
- Centered R² 가 묻는 것: "평균을 그대로 내놓는 baseline 보다 model 이 얼마나 나은가?"
- Uncentered R² 가 묻는 것: "model 의 예측이 1:1 identity line (y=x) 에 얼마나 가까운가?"
- Pros: 척도와 단위에 무관하여 서로 다른 물리량의 model 을 견줄 수 있다. Pearson 상관계수의 제곱과 같으므로 통계적 직관이 풍부하다.
-
Cons:
$y$ 의 분산이 작으면 (거의 일정하면) 분모가 0 에 가까워져 R² 가 무너지거나 음수가 된다. 평균 예측기 대비 상대 성능만 재므로 계통적 bias 에 둔감하다.
- Pros: 같은 물리량 수준에서 model, dataset, 실험을 견줄 때 uncentered R² 는 일관된 절대 baseline (0 예측) 을 주어 서로 견주는 일이 어긋나지 않게 한다. 저 분산 자료에 강건하다. 1:1 line 에서 벗어나는 것에 민감하여 계통적 bias 를 제대로 벌한다 [4].
-
Cons: 척도에 종속되므로 단위나 값 범위가 다른 model 을 견주는 데는 맞지
않는다.
$\bar{y}$ 가 크면$R^2_u$ 는 인위적으로 1 에 가까워진다. Uncentered$R^2$ 값은 대체로 훨씬 높게 (흔히 0.99 이상) 나오는데, 분모$\sum y_i^2$ 이 centered 분모$\sum (y_i - \bar{y})^2$ 보다 일반적으로 훨씬 크기 때문이다. 이것만 떼어 읽으면 지나치게 낙관적인 평가로 이어진다. 다만 min-max 정규화된 자료에서는 척도가 고르므로 uncentered$R^2$ 가 관측값과 예측값 사이의 절대 일치를 재는 데 더 나은 지표가 된다.
Key question: 같은 물리량의 자료에서 model 을 견줄 때 uncentered R² 가 실제로
더 정확한가? 답은 사실상 "그렇다" 이다. 같은 단위의 자료에서
- 일반적인 회귀와 ML modeling 의 표준 성능 지표.
- 단위나 영역이 다른 model 의 성능을 정규화된 형태로 견주는 일.
- Pearson 상관에 바탕을 둔 변동 설명력 평가 [1].
-
Regression Through the Origin (RTO): Hooke 의 법칙이나 방사성 붕괴처럼
물리적으로 0 을 지나야 하는 model. Stata, R, EViews 의
noconstantoption 은 자동으로 uncentered R² 를 내놓는다 [2]. 절편을 0 으로 고정하면 표준 (centered)$R^2$ 는 음수가 되거나 잘못된 해석을 낳는다. 이런 자리에서 uncentered$R^2$ 는 원점 기준으로 model 의 적합을 평가하는 강건한 대안으로 쓰인다. -
계량경제학의 진단 검정: Breusch-Pagan 검정과 White 검정의 보조 회귀는
$nR^2$ 를 chi-square 통계량으로 쓰는데, 이때의 계산이 uncentered 형태이다 [6]. -
$Y_{true}$ 대$Y_{pred}$ 그림에서 1:1 line 이탈 평가: 같은 물리량 자료를 다루는 ML 예측 과제에서 uncentered R² 는 절대 일치를 잰다. Calibration, Computational Fluid Dynamics (CFD) 와 Finite Element Method (FEM) 검증, sensor 교정, 재현성 연구에 알맞다.
관측값
OLS 정규방정식
적합값 vector 와 잔차 vector 는 직교한다. 이는 model 에 절편이 있든 없든 성립한다.
교차항은 직교성
양변을
Definition: Uncentered R²
Uncentered R² 는 0 을 기준으로 한 총제곱합$TSS_u$ 가운데 model 이 설명한$ESS_u$ 의 비율이다.
설계행렬
y
/|
/ |
/ | e (perpendicular residual)
/ |
/____|
origin ŷ (on the C(X) plane)
이것이
여기서
평균 vector
여기서
y
/|
/ |
/ |
/ | e
/ |
/ |
*------ŷ-----→ (C(X) plane)
origin
/
*────────── 1 direction (constant vector)
ȳ·1
-
Uncentered R²: 원점에서 잰
$\mathbf{y}$ 와$\hat{\mathbf{y}}$ 사이의 각이다. -
Centered R²: 기준점을
$\bar{y}\cdot\mathbf{1}$ 로 옮긴 뒤에 잰 각이다.
근본적인 차이는 기준점이 원점인가 평균 vector 인가에 있다. 같은 자료라도 기준점을 달리 하여 보면 두 vector 사이의 각이 달라진다.
Table 1. Geometric distinction between uncentered and centered R²
| Aspect | Uncentered | Centered |
|---|---|---|
| Reference point | 원점 0 | 평균 vector ȳ·1 |
| Right triangle | y, ŷ, e | ỹ, ŷ̃, e |
| Angle interpretation | cos²(∠yŷ) | cos²(∠ỹŷ̃) = r² |
| Required condition | e ⊥ ŷ | e ⊥ ŷ 이고 1 ∈ C(X) |
| Sensitivity to bias | 민감함 (원점 고정) | 둔감함 (평균 이동에 불변) |
1:1 line 검증의 기하학적 뜻: 일정한 bias
[1] Draper, N. R., & Smith, H. (1998). Applied Regression Analysis (3rd ed.). Wiley.
[2] Eisenhauer, J. G. (2003). Regression through the origin. Teaching Statistics, 25(3), 76–80.
[3] Kvalseth, T. O. (1985). Cautionary note about R². The American Statistician, 39(4), 279–285.
[4] Legates, D. R., & McCabe, G. J. (1999). Evaluating the use of "goodness-of-fit" measures in hydrologic and hydroclimatic model validation. Water Resources Research, 35(1), 233–241.
[5] Strang, G. (2009). Introduction to Linear Algebra (4th ed.). Wellesley-Cambridge Press. ISBN 978-0-9802327-1-4.
[6] Wooldridge, J. M. (2010). Econometric Analysis of Cross Section and Panel Data (2nd ed.). MIT Press. ISBN 978-0-262-23258-6.
- centered R²: 표준 R² 이며, 분모가 자료 평균 둘레의 제곱합인 것.
- CFD: Computational Fluid Dynamics. 유체 흐름의 numerical 모사.
-
ESS: Explained Sum of Squares. Uncentered 형태에서는
$\sum \hat{y}_i^2$ . - FEM: Finite Element Method. 이산화된 영역에서 장 문제를 수치로 푸는 방법.
- MAE: Mean Absolute Error. 잔차 절댓값의 평균.
- MAPE: Mean Absolute Percentage Error. 잔차 절댓값을 관측값에 대한 백분율로 적은 것의 평균. 관측값이 0 인 자리에서는 정의되지 않는다.
- OLS: Ordinary Least Squares. 잔차 제곱합을 최소로 하는 추정량.
- RMSE: Root Mean Squared Error. 잔차 제곱 평균의 제곱근.
- RSQ: Pearson 상관계수의 제곱을 뜻하는 Excel 함수 이름이며, centered R² 와 같다.
-
RSS: Residual Sum of Squares.
$\sum e_i^2$ . - RTO: Regression Through the Origin. 절편을 0 으로 고정한 회귀.
-
TSS: Total Sum of Squares. Uncentered 형태에서는
$\sum y_i^2$ , centered 형태에서는$\sum (y_i - \bar{y})^2$ . - uncentered R²: 분모가 평균이 아니라 0 둘레의 제곱합인 R².
import numpy as np
def centered_r2(y_true, y_pred):
"""
Centered R² (standard R²)
R²_c = 1 - SSE / SST_centered
"""
y_true = np.asarray(y_true, dtype=float)
y_pred = np.asarray(y_pred, dtype=float)
sse = np.sum((y_true - y_pred) ** 2)
sst_c = np.sum((y_true - np.mean(y_true)) ** 2)
if sst_c == 0:
return np.nan # undefined when y has zero variance
return 1.0 - sse / sst_c
# Example usage
y_true = np.array([10.1, 10.2, 10.3, 10.4, 10.5])
y_pred = np.array([10.0, 10.3, 10.2, 10.5, 10.4])
print(f"Centered R²: {centered_r2(y_true, y_pred):.6f}")
# Confirm equivalence with scikit-learn
from sklearn.metrics import r2_score
print(f"sklearn r2: {r2_score(y_true, y_pred):.6f}")def uncentered_r2(y_true, y_pred):
"""
Uncentered R² (origin-based R²)
R²_u = 1 - SSE / SST_uncentered
= ⟨ŷ, ŷ⟩ / ⟨y, y⟩ (when e ⊥ ŷ)
"""
y_true = np.asarray(y_true, dtype=float)
y_pred = np.asarray(y_pred, dtype=float)
sse = np.sum((y_true - y_pred) ** 2)
sst_u = np.sum(y_true ** 2)
if sst_u == 0:
return np.nan
return 1.0 - sse / sst_u
# Example usage — comparing predictions on a same-physical-quantity scale (e.g., voltage)
y_true = np.array([10.1, 10.2, 10.3, 10.4, 10.5])
y_pred = np.array([10.0, 10.3, 10.2, 10.5, 10.4])
print(f"Uncentered R²: {uncentered_r2(y_true, y_pred):.6f}")
# Constant-bias scenario: contrast between the two metrics
y_pred_biased = y_true + 0.5 # all predictions offset by +0.5
print(f"\nConstant bias +0.5 scenario:")
print(f" Centered R²: {centered_r2(y_true, y_pred_biased):.6f} "
f"(insensitive to bias)")
print(f" Uncentered R²: {uncentered_r2(y_true, y_pred_biased):.6f} "
f"(sensitive to bias)")def evaluate_1_to_1_line_agreement(y_true, y_pred):
"""Evaluate 1:1-line agreement on same-physical-quantity data."""
y_true = np.asarray(y_true, dtype=float)
y_pred = np.asarray(y_pred, dtype=float)
err = y_pred - y_true
rmse = np.sqrt(np.mean(err ** 2))
mae = np.mean(np.abs(err)) # Mean Absolute Error
bias = np.mean(err) # Mean Error (systematic bias)
# MAPE: Mean Absolute Percentage Error (%) — undefined when y_true contains 0
mask = y_true != 0
if mask.any():
mape = np.mean(np.abs(err[mask] / y_true[mask])) * 100.0
else:
mape = np.nan
return {
"CenteredR2": centered_r2(y_true, y_pred),
"UncenteredR2": uncentered_r2(y_true, y_pred),
"RMSE": rmse,
"MAE": mae,
"MAPE": mape,
"Bias": bias,
}
# Example usage
y_true = np.array([10.1, 10.2, 10.3, 10.4, 10.5])
y_pred = np.array([10.0, 10.3, 10.2, 10.5, 10.4])
results = evaluate_1_to_1_line_agreement(y_true, y_pred)
for k, v in results.items():
print(f"{k:>15s}: {v:.6f}")