# Leave One Out Cross Validation MSE calculation

I have a bit of a misunderstanding of what sample is being used to calculate the MSE each time in the procedure for LOOCV. I believe that it is the training set rather than the test set. Is the training set or test set being used to calculate the MSE in the procedure for LOOCV?

• Why do you think that it's calculated from the training set? Jul 20, 2020 at 14:53
• Now I'm thinking it might be the test set because this is one that we are testing our predictions. Thus, we would want to determine accuracy from this validation set/training set. Maybe this isn't the correct reasoning. Jul 20, 2020 at 15:10
• CV is not done on a holdout test set. Jul 20, 2020 at 15:22

In Leave-one-out cross validation (LOOCV) method, for each observation in our sample, say the $$i$$-th one, we first fit the same model keeping aside the $$i$$-th observation and then calculate the mean squared error for the $$i$$-th observation. Finally we take the average of these individual mean squared errors.
For example, suppose our model is $$Y = f(X) + \varepsilon$$ and we have some estimate for $$f,$$ say $$\hat{f},$$ which is computed on the basis of all observations. Now in LOOCV method, we calculate $$\hat{f}$$ after deleting the $$i$$-th observation from our dataset, let's call it $$\hat{f}_{-i}(x)$$ and then compute $$(y_i - \hat{f}_{-i}(x_i))^2.$$ Finally we compute the average of these quantities.