library(caret)
# datasets:
original = c( -2, 1, -3, 2, 3, 5, 4, 6, 5, 6, 7)
predicted = c(-1, -1, -2, 2, 3, 4, 4, 5, 5, 7, 7)
# caret package functions
RMSE(predicted, original)
R2(predicted, original, form = "traditional")
[1] 0.904534
d = original-predicted
mse = mean((d)^2)
mae = mean(abs(d))
rmse = sqrt(mse)
R2 = 1-(sum((d)^2)/sum((original-mean(original))^2))
cat(" MAE:", mae, "
", "MSE:", mse, "
",