# Calculate RMSE based on R squared and vice versa

If for example I have the value of RMSE can I calculate the $$R^2$$? And vice versa if I have the value of $$R^2$$ can I calculate the value of RMSE?

I have all predictions, dataset, training set, and test set.

$$R^2 = 1 - \dfrac{(RMSE)^2} { \sigma^2_y }$$
(Use the “population” variance calculation for $$\sigma^2_y$$.)
You have to have the denominator term in order to convert between $$R^2$$ and $$RMSE$$, but once you do, it’s just simple algebra.