# Mean squared error

In statistics, the mean squared error (MSE) of an estimator is one of many ways to quantify the difference between values implied by a kernel density estimator and the true values of the quantity being estimated. MSE is a risk function, corresponding to the expected value of the squared error loss or quadratic loss. MSE measures the average of the squares of the "errors." The error is the amount by which the value implied by the estimator differs from the quantity to be estimated. The difference occurs because of randomness or because the estimator doesn't account for information that could produce a more accurate estimate.[1]

The MSE is the second moment (about the origin) of the error, and thus incorporates both the variance of the estimator and its bias. For an unbiased estimator, the MSE is the variance. Like the variance, MSE has the same units of measurement as the square of the quantity being estimated. In an analogy to standard deviation, taking the square root of MSE yields the root mean square error or root mean square deviation (RMSE or RMSD), which has the same units as the quantity being estimated; for an unbiased estimator, the RMSE is the square root of the variance, known as the standard deviation.

## Definition and basic properties

The MSE of an estimator $\hat{\theta}$ with respect to the estimated parameter θ is defined as

$\operatorname{MSE}(\hat{\theta})=\operatorname{E}\big[(\hat{\theta}-\theta)^2\big].$

The MSE is equal to the sum of the variance and the squared bias of the estimator

$\operatorname{MSE}(\hat{\theta})=\operatorname{Var}(\hat{\theta})+ \left(\operatorname{Bias}(\hat{\theta},\theta)\right)^2.$

The MSE thus assesses the quality of an estimator in terms of its variation and unbiasedness. Note that the MSE is not equivalent to the expected value of the absolute error.

Since MSE is an expectation, it is not a random variable. It may be a function of the unknown parameter θ, but it does not depend on any random quantities. However, when MSE is computed for a particular estimator of θ the true value of which is not known, it will be subject to estimation error. In a Bayesian sense, this means that there are cases in which it may be treated as a random variable.

### Alternative usages

In regression analysis, the term mean squared error is sometimes used to refer to the estimate of error variance: residual sum of squares divided by the number of degrees of freedom. This is an observed quantity given a particular sample (and hence is sample-dependent), whereas the definition above is a function of the parameters of the probability distribution of an unknown parameter. For more details, see errors and residuals in statistics.

Also in regression analysis, "mean squared error", often referred to as "out-of-sample mean squared error", can refer to the mean value of the squared deviations of the predictions from the true values, over an out-of-sample test space, generated by a model estimated over a particular sample space. This also is an observed quantity, and it varies by sample and by out-of-sample test space.

## Examples

Suppose we have a random sample of size n from a population, $X_1,\dots,X_n$. The usual estimator for the mean is the sample average

$\overline{X}=\frac{1}{n}\sum_{i=1}^n(X_i)$

which has an expected value of μ (so it is unbiased) and a mean square error of

$\operatorname{MSE}(\overline{X})=\operatorname{E}((\overline{X}-\mu)^2)=\left(\frac{\sigma}{\sqrt{n}}\right)^2= \frac{\sigma^2}{n}$

For a Gaussian distribution this is the best unbiased estimator (that is, it has the lowest MSE among all unbiased estimators), but not, say, for a uniform distribution.

The usual estimator for the variance is

$S^2_{n-1} = \frac{1}{n-1}\sum_{i=1}^n\left(X_i-\overline{X}\,\right)^2 =\frac{1}{n-1}\left(\sum_{i=1}^n X_i^2-n\overline{X}^2\right).$

This is unbiased (its expected value is σ2), and its MSE is[2]

\begin{align}\operatorname{MSE}(S^2_{n-1})&= \frac{1}{n} \left(\mu_4-\frac{n-3}{n-1}\sigma^4\right) \\ &=\frac{1}{n} \left(\gamma_2+\frac{2n}{n-1}\right)\sigma^4,\end{align}

where μ4 is the fourth central moment of the distribution or population and γ2 = μ4 / σ4 − 3 is the excess kurtosis.

However, one can use other estimators for σ2 which are proportional to $S^2_{n-1}$, and an appropriate choice can always give a lower mean square error. If we define

\begin{align}S^2_a &= \frac{n-1}{a}S^2_{n-1}\\ &= \frac{1}{a}\sum_{i=1}^n\left(X_i-\overline{X}\,\right)^2\end{align}

then the MSE is

\begin{align} \operatorname{MSE}(S^2_a)&=\operatorname{E}\left(\left(\frac{n-1}{a} S^2_{n-1}-\sigma^2\right)^2 \right) \\ &=\frac{n-1}{n a^2}[(n-1)\gamma_2+n^2+n]\sigma^4-\frac{2(n-1)}{a}\sigma^4+\sigma^4 \end{align}

This is minimized when

$a=\frac{(n-1)\gamma_2+n^2+n}{n} = n+1+\frac{n-1}{n}\gamma_2.$

For a Gaussian distribution, where γ2 = 0, this means the MSE is minimized when dividing the sum by a = n + 1, whereas for a Bernoulli distribution with p = 1/2 (a coin flip), γ2 = − 2, the MSE is minimized for a = n − 1 + 2 / n. (Note that this particular case of the Bernoulli distribution has the lowest possible excess kurtosis; this can be proved by Jensen's inequality as follows. The fourth central moment is an upper bound for the square of variance, so that the least value for their ratio is one, therefore, the least value for the excess kurtosis is -2, achieved, for instance, by a Bernoulli with p=1/2.) So no matter what the kurtosis, we get a "better" estimate (in the sense of having a lower MSE) by scaling down the unbiased estimator a little bit. Even among unbiased estimators, if the distribution is not Gaussian the best (minimum mean square error) estimator of the variance may not be $S^2_{n-1}.$

The following table gives several estimators of the true parameters of the population, μ and σ2, for the Gaussian case.[3]

True value Estimator Mean squared error
θ = μ $\hat{\theta}$ = the unbiased estimator of the population mean, $\overline{X}=\frac{1}{n}\sum_{i=1}^n(X_i)$ $\operatorname{MSE}(\overline{X})=\operatorname{E}((\overline{X}-\mu)^2)=\left(\frac{\sigma}{\sqrt{n}}\right)^2$
θ = σ2 $\hat{\theta}$ = the unbiased estimator of the population variance, $S^2_{n-1} = \frac{1}{n-1}\sum_{i=1}^n\left(X_i-\overline{X}\,\right)^2$ $\operatorname{MSE}(S^2_{n-1})=\operatorname{E}((S^2_{n-1}-\sigma^2)^2)=\frac{2}{n - 1}\sigma^4$
θ = σ2 $\hat{\theta}$ = the biased estimator of the population variance, $S^2_{n} = \frac{1}{n}\sum_{i=1}^n\left(X_i-\overline{X}\,\right)^2$ $\operatorname{MSE}(S^2_{n})=\operatorname{E}((S^2_{n}-\sigma^2)^2)=\frac{2n - 1}{n^2}\sigma^4$
θ = σ2 $\hat{\theta}$ = the biased estimator of the population variance, $S^2_{n+1} = \frac{1}{n+1}\sum_{i=1}^n\left(X_i-\overline{X}\,\right)^2$ $\operatorname{MSE}(S^2_{n+1})=\operatorname{E}((S^2_{n+1}-\sigma^2)^2)=\frac{2}{n + 1}\sigma^4$

Note that:

1. The MSEs shown for the variance estimators assume $X_i \sim \operatorname{N}(\mu,\sigma^2)$ i.i.d. so that $\frac{(n-1)S^2_{n-1}}{\sigma^2}\sim \chi^2_{n-1}$. The result for $S^2_{n-1}$ follows easily from the $\chi^2_{n-1}$ variance that is 2n − 2.
2. Unbiased estimators may not produce estimates with the smallest total variation (as measured by MSE): the MSE of $S^2_{n-1}$ is larger than that of $S^2_{n+1}$ or $S^2_n$.
3. Estimators with the smallest total variation may produce biased estimates: $S^2_{n+1}$ typically underestimates σ2 by $\frac{2}{n}\sigma^2$

## Interpretation

An MSE of zero, meaning that the estimator $\hat{\theta}$ predicts observations of the parameter θ with perfect accuracy, is the ideal, but is practically never possible.

Values of MSE may be used for comparative purposes. Two or more statistical models may be compared using their MSEs as a measure of how well they explain a given set of observations: The unbiased model with the smallest MSE is generally interpreted as best explaining the variability in the observations and is called the best unbiased estimator or MVUE (Minimum Variance Unbiased Estimator).

Both linear regression techniques such as analysis of variance estimate the MSE as part of the analysis and use the estimated MSE to determine the statistical significance of the factors or predictors under study. The goal of experimental design is to construct experiments in such a way that when the observations are analyzed, the MSE is close to zero relative to the magnitude of at least one of the estimated treatment effects.

MSE is also used in several stepwise regression techniques as part of the determination as to how many predictors from a candidate set to include in a model for a given set of observations.

## Applications

• Minimizing MSE is a key criterion in selecting estimators:see Minimum mean-square error. Among unbiased estimators, the minimal MSE is equivalent to minimizing the variance, and is obtained by the MVUE. However, a biased estimator may have lower MSE; see estimator bias.
• In statistical modelling the MSE, representing the difference between the actual observations and the response predicted by the model, is used to determine whether the model does not fit the data or whether the model can be simplified by removing terms.

## As a loss function

Squared error loss is one of the most widely used loss functions in statistics, though its widespread use stems more from mathematical convenience than considerations of actual loss in applications. Carl Friedrich Gauss, who introduced the use of mean squared error, was aware of its arbitrariness and was in agreement with objections to it on these grounds.[1] The mathematical benefits of mean squared error are particularly evident in its use at analyzing the performance of linear regression, as it allows one to partition the variation in a dataset into variation explained by the model and variation explained by randomness.

Criticism

The use of mean squared error without question has been criticized by the decision theorist James Berger. Mean squared error is the negative of the expected value of one specific utility function, the quadratic utility function, which may not be the appropriate utility function to use under a given set of circumstances. There are, however, some scenarios where mean squared error can serve as a good approximation to a loss function occurring naturally in an application.[4]

Like variance, mean squared error has the disadvantage of heavily weighting outliers.[5] This is a result of the squaring of each term, which effectively weights large errors more heavily than small ones. This property, undesirable in many applications, has led researchers to use alternatives such as the mean absolute error, or those based on the median.

## Notes

1. ^ a b Lehmann, E. L.; Casella, George (1998). Theory of Point Estimation (2nd ed.). New York: Springer. ISBN 0-387-98502-6. MR1639875.
2. ^ Mood, A.; Graybill, F.; Boes, D. (1974). Introduction to the Theory of Statistics (3rd ed.). McGraw-Hill. p. 229.
3. ^ DeGroot, Morris H. (1980). Probability and Statistics (2nd ed.). Addison-Wesley.
4. ^ Berger, James O. (1985). "2.4.2 Certain Standard Loss Functions". Statistical decision theory and Bayesian Analysis (2nd ed.). New York: Springer-Verlag. p. 60. ISBN 0-387-96098-8. MR0804611.
5. ^ Sergio Bermejo, Joan Cabestany (2001) "Oriented principal component analysis for large margin classifiers", Neural Networks, 14 (10), 1447–1461.

Wikimedia Foundation. 2010.

### Look at other dictionaries:

• Mean squared error — Zwei Schätzfunktionen: Die Wahl einer verzerrten Statistik kann hinsichtlich ihrer erwarteten Abweichung vom echten Wert gegenüber einer unverzerrten vorteilhaft sein. Die mittlere quadratische Abweichung oder mittlerer quadratischer Fehler (engl …   Deutsch Wikipedia

• Mean percentage error — In statistics, the mean percentage error (MPE) is the computed average of percentage errors by which estimated forecasts differ from actual values of the quantity being forecast. Formula for mean percentage error calculation is: where at is the… …   Wikipedia

• Mean absolute error — In statistics, the mean absolute error (MAE) is a quantity used to measure how close forecasts or predictions are to the eventual outcomes. The mean absolute error is given by As the name suggests, the mean absolute error is an average of the… …   Wikipedia

• Mean squared prediction error — In statistics the mean squared prediction error of a smoothing procedure is the expected sum of squared deviations of the fitted values from the (unobservable) function g. If the smoothing procedure has operator matrix L, then The MSPE can be… …   Wikipedia

• Mean integrated squared error — In statistics, the mean integrated squared error (MISE) is used in density estimation. The MISE of an estimate of an unknown probability density is given by where ƒ is the unknown density, ƒn is its estimate based on a sample of n iid random… …   Wikipedia

• Minimum mean square error — In statistics and signal processing, a minimum mean square error (MMSE) estimator describes the approach which minimizes the mean square error (MSE), which is a common measure of estimator quality. The term MMSE specifically refers to estimation… …   Wikipedia

• Mean absolute scaled error — In statistics, the mean absolute scaled error (MASE) is a measure of the accuracy of forecasts . It was proposed in 2006 by Australian statistician Rob Hyndman, who described it as a generally applicable measurement of forecast accuracy without… …   Wikipedia

• Mean square quantization error — (MSQE) is a figure of merit for the process of analog to digital conversion. As the input is varied, the input s value is recorded when the digital output changes. For each digital output, the input s difference from ideal is normalized to the… …   Wikipedia

• Mean — This article is about the statistical concept. For other uses, see Mean (disambiguation). In statistics, mean has two related meanings: the arithmetic mean (and is distinguished from the geometric mean or harmonic mean). the expected value of a… …   Wikipedia

• Root mean square deviation — The root mean square deviation (RMSD) ( also root mean square error (RMSE) ) is a frequently used measure of the differences between values predicted by a model or an estimator and the values actually observed from the thing being modeled or… …   Wikipedia