Jump to content

Mean squared error

From Wikipedia, the free encyclopedia

Instatistics,themean squared error(MSE)[1]ormean squared deviation(MSD) of anestimator(of a procedure for estimating an unobserved quantity) measures theaverageof the squares of theerrors—that is, the average squared difference between the estimated values and the actual value. MSE is arisk function,corresponding to theexpected valueof thesquared error loss.[2]The fact that MSE is almost always strictly positive (and not zero) is because ofrandomnessor because the estimatordoes not account for informationthat could produce a more accurate estimate.[3]Inmachine learning,specificallyempirical risk minimization,MSE may refer to theempiricalrisk (the average loss on an observed data set), as an estimate of the true MSE (the true risk: the average loss on the actual population distribution).

The MSE is a measure of the quality of an estimator. As it is derived from the square ofEuclidean distance,it is always a positive value that decreases as the error approaches zero.

The MSE is the secondmoment(about the origin) of the error, and thus incorporates both thevarianceof the estimator (how widely spread the estimates are from onedata sampleto another) and itsbias(how far off the average estimated value is from the true value).[citation needed]For anunbiased estimator,the MSE is the variance of the estimator. Like the variance, MSE has the same units of measurement as the square of the quantity being estimated. In an analogy tostandard deviation,taking the square root of MSE yields theroot-mean-square errororroot-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 thevariance,known as thestandard error.

Definition and basic properties[edit]

The MSE either assesses the quality of apredictor(i.e., a function mapping arbitrary inputs to a sample of values of somerandom variable), or of anestimator(i.e., amathematical functionmapping asampleof data to an estimate of aparameterof thepopulationfrom which the data is sampled). In the context of prediction, understanding theprediction intervalcan also be useful as it provides a range within which a future observation will fall, with a certain probability. The definition of an MSE differs according to whether one is describing a predictor or an estimator.

Predictor[edit]

If a vector ofpredictions is generated from a sample ofdata points on all variables, andis the vector of observed values of the variable being predicted, withbeing the predicted values (e.g. as from aleast-squares fit), then the within-sample MSE of the predictor is computed as

In other words, the MSE is themeanof thesquares of the errors.This is an easily computable quantity for a particular sample (and hence is sample-dependent).

Inmatrixnotation,

whereisandis acolumn vector.

The MSE can also be computed onqdata points that were not used in estimating the model, either because they were held back for this purpose, or because these data have been newly obtained. Within this process, known ascross-validation,the MSE is often called thetest MSE,[4]and is computed as

Estimator[edit]

The MSE of an estimatorwith respect to an unknown parameteris defined as[1]

This definition depends on the unknown parameter, but the MSE isa prioria property of an estimator. The MSE could be a function of unknown parameters, in which case anyestimatorof the MSE based on estimates of these parameters would be a function of the data (and thus a random variable). If the estimatoris derived as a sample statistic and is used to estimate some population parameter, then the expectation is with respect to the sampling distribution of the sample statistic.

The MSE can be written as the sum of thevarianceof the estimator and the squaredbiasof the estimator, providing a useful way to calculate the MSE and implying that in the case of unbiased estimators, the MSE and variance are equivalent.[5]

Proof of variance and bias relationship[edit]


An even shorter proof can be achieved using the well-known formula that for a random variable,.By substitutingwith,,we have

But in real modeling case, MSE could be described as the addition of model variance, model bias, and irreducible uncertainty (seeBias–variance tradeoff). According to the relationship, the MSE of the estimators could be simply used for theefficiencycomparison, which includes the information of estimator variance and bias. This is called MSE criterion.

In regression[edit]

Inregression analysis,plotting is a more natural way to view the overall trend of the whole data. The mean of the distance from each point to the predicted regression model can be calculated, and shown as the mean squared error. The squaring is critical to reduce the complexity with negative signs. To minimize MSE, the model could be more accurate, which would mean the model is closer to actual data. One example of a linear regression using this method is theleast squares method—which evaluates appropriateness of linear regression model to modelbivariate dataset,[6]but whose limitation is related to known distribution of the data.

The termmean squared erroris sometimes used to refer to the unbiased estimate of error variance: theresidual sum of squaresdivided by the number ofdegrees of freedom.This definition for a known, computed quantity differs from the above definition for the computed MSE of a predictor, in that a different denominator is used. The denominator is the sample size reduced by the number of model parameters estimated from the same data, (np) forpregressorsor (np−1) if an intercept is used (seeerrors and residuals in statisticsfor more details).[7]Although the MSE (as defined in this article) is not an unbiased estimator of the error variance, it isconsistent,given the consistency of the predictor.

In regression analysis, "mean squared error", often referred to asmean squared prediction erroror "out-of-sample mean squared error", can also refer to the mean value of thesquared deviationsof the predictions from the true values, over an out-of-sampletest space,generated by a model estimated over aparticular sample space.This also is a known, computed quantity, and it varies by sample and by out-of-sample test space.

In the context of gradient descent algorithms, it is common to introduce a factor ofto the MSE for ease of computation after taking the derivative. So a value which is technically half the mean of squared errors may be called the MSE.

Examples[edit]

Mean[edit]

Suppose we have a random sample of sizefrom a population,.Suppose the sample units were chosenwith replacement.That is, theunits are selected one at a time, and previously selected units are still eligible for selection for alldraws. The usual estimator for theis the sample average

which has an expected value equal to the true mean(so it is unbiased) and a mean squared error of

whereis thepopulation variance.

For aGaussian distribution,this is thebest unbiased estimator(i.e., one with the lowest MSE among all unbiased estimators), but not, say, for auniform distribution.

Variance[edit]

The usual estimator for the variance is thecorrectedsample variance:

This is unbiased (its expected value is), hence also called theunbiased sample variance,and its MSE is[8]

whereis the fourthcentral momentof the distribution or population, andis theexcess kurtosis.

However, one can use other estimators forwhich are proportional to,and an appropriate choice can always give a lower mean squared error. If we define

then we calculate:

This is minimized when

For aGaussian distribution,where,this means that the MSE is minimized when dividing the sum by.The minimum excess kurtosis is,[a]which is achieved by aBernoulli distributionwithp= 1/2 (a coin flip), and the MSE is minimized forHence regardless of the kurtosis, we get a "better" estimate (in the sense of having a lower MSE) by scaling down the unbiased estimator a little bit; this is a simple example of ashrinkage estimator:one "shrinks" the estimator towards zero (scales down the unbiased estimator).

Further, while the corrected sample variance is thebest unbiased estimator(minimum mean squared error among unbiased estimators) of variance for Gaussian distributions, if the distribution is not Gaussian, then even among unbiased estimators, the best unbiased estimator of the variance may not be

Gaussian distribution[edit]

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

True value Estimator Mean squared error
= the unbiased estimator of thepopulation mean,
= the unbiased estimator of thepopulation variance,
= the biased estimator of thepopulation variance,
= the biased estimator of thepopulation variance,

Interpretation[edit]

An MSE of zero, meaning that the estimatorpredicts observations of the parameterwith perfect accuracy, is ideal (but typically not possible).

Values of MSE may be used for comparative purposes. Two or morestatistical modelsmay be compared using their MSEs—as a measure of how well they explain a given set of observations: An unbiased estimator (estimated from a statistical model) with the smallest variance among all unbiased estimators is thebest unbiased estimatoror MVUE (Minimum-Variance Unbiased Estimator).

Bothanalysis of varianceandlinear regressiontechniques estimate the MSE as part of the analysis and use the estimated MSE to determine thestatistical significanceof the factors or predictors under study. The goal ofexperimental designis 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.

Inone-way analysis of variance,MSE can be calculated by the division of the sum of squared errors and the degree of freedom. Also, the f-value is the ratio of the mean squared treatment and the MSE.

MSE is also used in severalstepwise regressiontechniques 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[edit]

  • Minimizing MSE is a key criterion in selecting estimators: seeminimum mean-square error.Among unbiased estimators, minimizing the MSE is equivalent to minimizing the variance, and the estimator that does this is theminimum variance unbiased estimator.However, a biased estimator may have lower MSE; seeestimator bias.
  • Instatistical modellingthe MSE can represent the difference between the actual observations and the observation values predicted by the model. In this context, it is used to determine the extent to which the model fits the data as well as whether removing some explanatory variables is possible without significantly harming the model's predictive ability.
  • Inforecastingandprediction,theBrier scoreis a measure offorecast skillbased on MSE.

Loss function[edit]

Squared error loss is one of the most widely usedloss functionsin 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.[3]The mathematical benefits of mean squared error are particularly evident in its use at analyzing the performance oflinear regression,as it allows one to partition the variation in a dataset into variation explained by the model and variation explained by randomness.

Criticism[edit]

The use of mean squared error without question has been criticized by thedecision theoristJames Berger.Mean squared error is the negative of the expected value of one specificutility 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.[10]

Likevariance,mean squared error has the disadvantage of heavily weightingoutliers.[11]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 themean absolute error,or those based on themedian.

See also[edit]

Notes[edit]

  1. ^This can be proved byJensen's inequalityas follows. The fourthcentral momentis an upper bound for the square of variance, so that the least value for their ratio is one, therefore, the least value for theexcess kurtosisis −2, achieved, for instance, by a Bernoulli withp=1/2.

References[edit]

  1. ^ab"Mean Squared Error (MSE)".probabilitycourse.Retrieved2020-09-12.
  2. ^Bickel, Peter J.;Doksum, Kjell A. (2015).Mathematical Statistics: Basic Ideas and Selected Topics.Vol. I (Second ed.). p. 20.If we use quadratic loss, our risk function is called themean squared error(MSE)...
  3. ^abLehmann, E. L.; Casella, George (1998).Theory of Point Estimation(2nd ed.). New York: Springer.ISBN978-0-387-98502-2.MR1639875.
  4. ^Gareth, James; Witten, Daniela; Hastie, Trevor; Tibshirani, Rob (2021).An Introduction to Statistical Learning: with Applications in R.Springer.ISBN978-1071614174.
  5. ^Wackerly, Dennis; Mendenhall, William; Scheaffer, Richard L. (2008).Mathematical Statistics with Applications(7 ed.). Belmont, CA, USA: Thomson Higher Education.ISBN978-0-495-38508-0.
  6. ^A modern introduction to probability and statistics: understanding why and how.Dekking, Michel, 1946-. London: Springer. 2005.ISBN978-1-85233-896-1.OCLC262680588.{{cite book}}:CS1 maint: others (link)
  7. ^Steel, R.G.D, and Torrie, J. H.,Principles and Procedures of Statistics with Special Reference to the Biological Sciences.,McGraw Hill,1960, page 288.
  8. ^Mood, A.; Graybill, F.; Boes, D. (1974).Introduction to the Theory of Statistics(3rd ed.). McGraw-Hill. p.229.
  9. ^DeGroot, Morris H.(1980).Probability and Statistics(2nd ed.). Addison-Wesley.
  10. ^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.ISBN978-0-387-96098-2.MR0804611.
  11. ^Bermejo, Sergio; Cabestany, Joan (2001). "Oriented principal component analysis for large margin classifiers".Neural Networks.14(10): 1447–1461.doi:10.1016/S0893-6080(01)00106-X.PMID11771723.