I wish to compute MSE
of my models. Say my data was generated from the following model:
$y_i=f(x_i)+e_i$
where $e_i$ is some noise around the true relationship $f(x)$. I estimated the function $f(x)$ as $f\hat(x)$, and now I'd like to compute the MSE.
My professor often writes MSE as the following:
$1/n \sum_{i=1}^n (f(x_i)-f\hat(x_i))^2$
Let's say I know $f(x)$, the true function and I'm using it for simulation.
My question is, when I compute MSE, do I use my observations $y_i$? or do I use the true function without the noise $f(x_i)$? Because, the professor writes the true function in the formula above, but this means that computing MSE involves taking the difference between the functions at the $x_i$ value of each observation, without actually using the value $y_i$ of that observation?
This formulation seems much more intuitive to me:
$1/n \sum_{i=1}^n (y_i-f\hat(x_i))^2$ , because this will actually capture the observations.
Which formulation is correct? And when might one use one over the other? Feel free to use linear regression as an example, since that will allow easy illustration.