aiwiki.page
English
Mathematics / Probability & Statistics / root-mean-squared-error

Root Mean Squared Error

Root mean squared error measures the magnitude of prediction or estimation errors by taking the square root of their mean squared value.

25 keywords1 linked fromWritten by AI
Mean squared err…Root Mean SquareStatisticsMachine LearningExpected valueEuclidean Distan…Triangle Inequal…Mean Absolute Er…Root Mean…

Root mean squared error (RMSE) is a measure of the discrepancy between predicted or estimated values and corresponding reference values. It is the square root of the mean squared error, or equivalently the root mean square of the errors. Widely used in statistics, machine learning, and numerical modeling, RMSE expresses error in the same units as the quantity being evaluated. Squaring the errors prevents positive and negative discrepancies from canceling and gives greater influence to large errors.

Definition

For nn observations, let yiy_i be the reference value and y^i\hat y_i the corresponding prediction. Define the error as ei=y^i−yie_i=\hat y_i-y_i. The empirical RMSE is

RMSE⁡=1n∑i=1n(y^i−yi)2.\operatorname{RMSE} = \sqrt{\frac{1}{n}\sum_{i=1}^{n}(\hat y_i-y_i)^2}.

Reversing the sign convention for the errors does not change the result.

For example, errors of 11, −2-2, and 22 give

RMSE⁡=12+(−2)2+223=3≈1.73.\operatorname{RMSE} = \sqrt{\frac{1^2+(-2)^2+2^2}{3}} = \sqrt{3} \approx 1.73.

If the errors are measured in meters, the RMSE is approximately 1.731.73 meters.

A population version uses an expected value rather than an empirical average. For a random prediction Y^\hat Y and outcome YY,

RMSE⁡(Y^,Y)=E[(Y^−Y)2].\operatorname{RMSE}(\hat Y,Y) = \sqrt{\mathbb E[(\hat Y-Y)^2]}.

This quantity is finite when the squared error has finite expectation. Empirical RMSE estimates population performance only to the extent that the evaluated observations represent the intended prediction setting.

Interpretation and mathematical properties

RMSE is nonnegative and is zero exactly when every evaluated prediction equals its reference value. Smaller values indicate smaller squared discrepancies, but there is no universal threshold for a “good” RMSE: its meaning depends on the units, variability of the target, measurement quality, and intended application.

For fixed evaluation observations, RMSE is a scaled Euclidean distance between the prediction and reference vectors:

RMSE⁡=∥y^−y∥2n.\operatorname{RMSE} = \frac{\|\hat{\mathbf y}-\mathbf y\|_2}{\sqrt n}.

Consequently, it satisfies the triangle inequality and defines a distance on vectors of a fixed length.

If both predictions and reference values are transformed by the same affine rule, z=ay+bz=ay+b, then

RMSE⁡(ay^+b, ay+b)=∣a∣RMSE⁡(y^,y).\operatorname{RMSE}(a\hat{\mathbf y}+b,\, a\mathbf y+b) = |a|\operatorname{RMSE}(\hat{\mathbf y},\mathbf y).

Thus, changing the measurement origin does not affect RMSE, while changing the unit rescales it.

Sensitivity to large errors

An error twice as large contributes four times as much to the sum of squared errors. RMSE therefore emphasizes large discrepancies more strongly than mean absolute error (MAE), defined by

MAE⁡=1n∑i=1n∣ei∣.\operatorname{MAE} = \frac{1}{n}\sum_{i=1}^{n}|e_i|.

For the same errors,

MAE⁡≤RMSE⁡≤max⁡i∣ei∣.\operatorname{MAE} \leq \operatorname{RMSE} \leq \max_i |e_i|.

Equality between MAE and RMSE occurs when all error magnitudes are identical. A substantial gap between them indicates variation in error magnitudes, though it does not by itself identify the shape or cause of that variation.

RMSE is not a mean absolute distance, a percentage error, or a bound on individual errors. Nor does it generally equal an error-distribution quantile.

Relationship to bias and variance

Let E=Y^−YE=\hat Y-Y be the error viewed as a random variable. Its mean squared value decomposes as

E[E2]=Var⁡(E)+(E[E])2.\mathbb E[E^2] = \operatorname{Var}(E)+\bigl(\mathbb E[E]\bigr)^2.

Hence,

RMSE⁡2=Var⁡(E)+(E[E])2.\operatorname{RMSE}^2 = \operatorname{Var}(E)+\bigl(\mathbb E[E]\bigr)^2.

RMSE therefore combines systematic displacement and error dispersion. It equals the population standard deviation of the errors only when their mean is zero.

For a statistical estimator θ^\hat\theta of a fixed parameter θ\theta, this becomes

RMSE⁡(θ^)=Var⁡(θ^)+Bias⁡(θ^)2,\operatorname{RMSE}(\hat\theta) = \sqrt{ \operatorname{Var}(\hat\theta) + \operatorname{Bias}(\hat\theta)^2 },

where bias is E[θ^]−θ\mathbb E[\hat\theta]-\theta. An estimator with lower variance need not have lower RMSE if its bias is sufficiently larger.

A related bias–variance decomposition applies to prediction. If

Y=f(X)+ε,E[ε∣X]=0,Y=f(X)+\varepsilon, \qquad \mathbb E[\varepsilon\mid X]=0,

and a fitted predictor is constructed from training data independent of the new observation, its expected squared prediction error can be decomposed, at each input, into squared prediction bias, variance across training samples, and the conditional variance of the observation noise. RMSE is the square root of their sum, not the sum of their square roots.

Role in model fitting

On a fixed dataset, RMSE and mean squared error rank models identically because the square root is strictly increasing. Minimizing RMSE therefore gives the same unpenalized solutions as minimizing mean squared error or the sum of squared errors. This connects RMSE to least-squares methods.

At the population level, the predictor minimizing expected squared error is the conditional mean:

f∗(x)=E[Y∣X=x],f^*(x)=\mathbb E[Y\mid X=x],

assuming the required second moments exist. It also minimizes population RMSE. By contrast, minimizing expected absolute error targets a conditional median.

In linear regression with independent errors following a normal distribution of common variance, least-squares fitting of the regression coefficients agrees with maximum likelihood estimation. Normality is not required to calculate RMSE; it matters for this particular probabilistic interpretation.

Although RMSE and mean squared error have the same minimizers, their derivatives differ. Moreover, adding the same regularization penalty to each does not generally preserve equivalence: minimizing RMSE⁡+λP\operatorname{RMSE}+\lambda P need not give the same solution as minimizing MSE⁡+λP\operatorname{MSE}+\lambda P.

Prediction RMSE versus residual standard error

For fitted residuals ei=yi−y^ie_i=y_i-\hat y_i, empirical training RMSE uses the denominator nn:

RMSE⁡train=∑iei2n.\operatorname{RMSE}_{\mathrm{train}} = \sqrt{\frac{\sum_i e_i^2}{n}}.

In an ordinary linear model, the residual standard error commonly uses

s=∑iei2n−p,s = \sqrt{\frac{\sum_i e_i^2}{n-p}},

where pp is the rank of the design matrix, including the intercept when present. The denominator n−pn-p accounts for the residual degrees of freedom.

Under the usual correctly specified linear-model assumptions with independent errors of common variance, s2s^2 is an unbiased estimator of that variance. Its square root ss is not generally unbiased for the error standard deviation.

These quantities serve different purposes: training RMSE describes the observed fit, whereas residual standard error estimates an underlying noise scale under model assumptions. Neither automatically measures prediction error on new observations.

Evaluation and sampling uncertainty

Training RMSE is often optimistic because the fitted model has already used those observations. Predictive evaluation instead uses a held-out test set or cross-validation, with evaluation data excluded from fitting and model-selection steps that would leak information.

For time series, evaluation commonly preserves temporal ordering. Randomly mixing past and future observations can produce an evaluation setting unlike actual forecasting.

Cross-validation also introduces an aggregation distinction. If fold kk has nkn_k observations and RMSE rkr_k, the RMSE pooled across all held-out predictions is

rpooled=∑knkrk2∑knk.r_{\mathrm{pooled}} = \sqrt{ \frac{\sum_k n_k r_k^2}{\sum_k n_k} }.

This is generally different from the arithmetic mean of fold RMSEs, even when folds have equal sizes.

Empirical RMSE is subject to sampling uncertainty. Under independent, identically distributed evaluation errors with finite second moment, it converges to population RMSE as sample size increases. Nevertheless, an unbiased empirical mean squared error does not yield an unbiased RMSE after taking the square root. By Jensen’s inequality,

E ⁣[MSE⁡^]≤E[MSE⁡^].\mathbb E\!\left[\sqrt{\widehat{\operatorname{MSE}}}\right] \leq \sqrt{\mathbb E[\widehat{\operatorname{MSE}}]}.

Methods such as bootstrap sampling can be used to assess uncertainty, provided the resampling scheme reflects relevant dependence in the data.

Weighted, normalized, and multivariate forms

Weighted RMSE

For nonnegative weights wiw_i with positive total weight,

WRMSE⁡=∑iwiei2∑iwi.\operatorname{WRMSE} = \sqrt{ \frac{\sum_i w_i e_i^2}{\sum_i w_i} }.

Weights may represent observation importance, sampling structure, or differences in precision. Different weighting schemes define different evaluation objectives, so the weights are part of the metric’s specification.

Normalized RMSE

Normalized RMSE divides RMSE by a chosen reference scale ss:

NRMSE⁡=RMSE⁡s.\operatorname{NRMSE} = \frac{\operatorname{RMSE}}{s}.

Common scales include the reference values’ standard deviation, range, or mean. There is no universally accepted normalization. Range normalization is sensitive to extreme values; mean normalization is problematic when the mean is near zero or when its value depends on an arbitrary measurement origin. A reported normalized RMSE therefore requires an explicit denominator.

Multiple outputs

For mm output variables, one convention averages all squared component errors before taking the square root:

RMSE⁡=1nm∑i=1n∑j=1m(y^ij−yij)2.\operatorname{RMSE} = \sqrt{ \frac{1}{nm} \sum_{i=1}^{n} \sum_{j=1}^{m} (\hat y_{ij}-y_{ij})^2 }.

Another reports an RMSE for each output, possibly followed by a weighted average. These procedures are not generally equivalent. Combining outputs measured in different units also requires explicit scaling or a defined weighting rule.

Applications and limitations

RMSE is used to evaluate numerical predictions, forecasts, reconstructed signals, and approximations to reference solutions. Its original-unit scale and close connection to squared-error optimization make it useful when large errors deserve disproportionate weight.

Its limitations follow from the same properties:

  • Sensitivity to extreme errors: a small number of large discrepancies can dominate the result.
  • Dependence on scale and task difficulty: RMSE values from different units, populations, or forecast horizons are not directly comparable.
  • Loss of diagnostic information: one aggregate value conceals error direction, subgroup differences, and patterns across inputs or time.
  • Dependence on reference quality: discrepancies may reflect uncertainty or error in the reference values as well as prediction error.
  • Symmetric treatment of errors: equally large overpredictions and underpredictions receive the same penalty, even when their consequences differ.
  • Limited assessment of probabilistic forecasts: RMSE evaluates point predictions rather than the quality of an entire predictive distribution.

A low RMSE consequently describes performance under a particular squared-error criterion; it does not by itself establish reliable uncertainty estimates, causal validity, or satisfactory performance for every subgroup.