# Mean squared error vs. mean squared prediction error

What is the semantic difference between Mean Squared Error (MSE) and Mean Squared Prediction Error (MSPE)?

The difference is not the mathematical expression, but rather what you are measuring.

Mean squared error measures the expected squared distance between an estimator and the true underlying parameter:

$$\text{MSE}(\hat{\theta}) = E\left[(\hat{\theta} - \theta)^2\right].$$

It is thus a measurement of the quality of an estimator.

The mean squared prediction error measures the expected squared distance between what your predictor predicts for a specific value and what the true value is:

$$\text{MSPE}(L) = E\left[\sum_{i=1}^n\left(g(x_i) - \widehat{g}(x_i)\right)^2\right].$$

It is thus a measurement of the quality of a predictor.

The most important thing to understand is the difference between a predictor and an estimator. An example of an estimator would be taking the average height a sample of people to estimate the average height of a population. An example of a predictor is to average the height of an individual's two parents to guess his specific height. They are thus solving two very different problems.

• But the wiki page of MSE also gives an example of MSE on predictors,en.wikipedia.org/wiki/Mean_squared_error Dec 26, 2013 at 13:09
• Not sure estimator vs predictor is meaningful here. Both are metrics that measure actual y vs f(x) where f(x) is meant to approximate y from feature vector x Dec 10, 2018 at 18:28
• This answer would be better if it addressed the possibility that MSE may be used to mean different things in different contexts. Feb 10, 2019 at 21:12

There is a correction to the second equation about:

$$MSPE(L)=\mathbb{E}\Big[\Big(g(X))-\widehat{g}(X)\Big)^{2}\Big]$$; where $$X$$ is a random variable.

It is important to remember that when we are working with MSPE or MSEP (I usually use the last expression) we are dealing with random variables. We want to predict an unobserved random variable $$X$$ using an estimator which is also a random variable (usually constructed with a sample data). There, we have a great difference with the most used expression MSE. In that case, we are dealing with a population parameter $$\theta$$ that it is a constant and the estimator is again a random variable.

In a more realistic scenario, we are dealing with conditional expectation for the MSPE because if we want to predict we need to measure the quality of our estimator based on the information used in the sample data. So, our definition of MSPE would be:

$$MSPE(L)=\mathbb{E}\Big[\Big(g(X))-\widehat{g}(X)\Big)^{2}\Big|\;\mathcal{G}\; \Big]$$; where $$\mathcal{G}$$ is a $$\sigma$$-algebra and $$\widehat{g}(X)$$ is $$\mathcal{G}$$-measurable. We can say that $$X$$ is $$\mathcal{F}$$-measurable in the measurable space $$(\Omega, \mathcal{F})$$ and $$g$$ is a borel-measurable function, so by Doob-Dynkin $$g(X)$$ is also $$\mathcal{F}$$-measurable.

Typically, MSE involves only training data. The error here refers to how far the observed training response data is from the fitted response data (based on a model fit on the training data itself).

On the other hand, MSPE typically involves a testing set that was not part of the model training. The error here refers to how far the predicted testing data (predicted based on a model already fit on the training data) is from the observed testing data.