rmse: Root Mean Squared Error (RMSE)

Description Usage Arguments Details Value Examples

View source: R/modeling.R

Description

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, y_hat at each observation i.

Usage

1
rmse(y, yhat)

Arguments

y

A vector of the true y values

yhat

A vector of predicted y hat values.

Details

The formula for RMSE is:

sqrt(mean((y-yhat)^2))

Value

The RMSE in numeric form

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Set seed for reproducibility
set.seed(100)

# Generate data
n = 1e2

y = rnorm(n)
yhat = rnorm(n, 0.5)

# Compute
o = mse(y, yhat)

Example output



jjb documentation built on Jan. 8, 2020, 5:07 p.m.