rmse | R Documentation |
Calculates the root mean square of the model by taking the square root of
mean of the sum of squares between the truth, y
, and the predicted,
\hat{y}
at each observation i
.
rmse(y, yhat)
y |
A |
yhat |
A |
The formula for RMSE is:
\sqrt {\frac{1}{n}\sum\limits_{i = 1}^n {{{\left( {{y_i} - {{\hat y}_i}} \right)}^2}} }
The RMSE in numeric
form
# Set seed for reproducibility
set.seed(100)
# Generate data
n = 1e2
y = rnorm(n)
yhat = rnorm(n, 0.5)
# Compute
o = mse(y, yhat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.