+1 vote
in Programming Languages by (40.5k points)
I want to calculate RMSE using predicted and actual values. Is there any R library that can be used instead of writing my own function?

1 Answer

+2 votes
by (73.8k points)
selected by
Best answer

There is an R library, "Metrics". Its rmse() function can be used to calculate the RMSE. 

Here is an example:

# Install and load the Metrics package

if (!require("Metrics")){




preds <- c(0.02, 0.04, 0.06, 0.65, 0.1)

trus <- c(0.012, 0.104, 0.206, 0.165, 0.21)

rmse(trus, preds)

Related questions