# How to compute $R^2$ of test set in leave-one-out CV?

In leave-one-out cross validation, at each iteration, my test set is composed by only one data point - precisely the "left out", to be compared with the predicted one, using the estimated coefficients from the train set. Normally, for the train set, one would compute the $$R^2$$ over several observations and fitted values. For the test set, how should one compute the $$R^2$$ between a pair of numbers, namely one observed and another predicted value? Is there a common convention on how to tackle this?

## 1 Answer

Gather all your predictions for the entire set (since each prediction is generated via CV, it's unbiased), and calculate the $$R^2$$ on all true vs prediction.

• I see, that solves. I guess I could bootstrap on this to estimate the uncertainties for this R2, right? – ouranos Apr 28 at 9:00
• Yes, you can do it. – gunes Apr 28 at 9:08