predictionError: Calculate the RMSE (Root Mean Squared Error) of a prediction...

Description Usage Arguments Value Examples

View source: R/predictionError.R

Description

Given an actual series, y and a fitted series, yhat, this function will return the RMSE, what I'm calling 'Prediction Error'. This is useful when comparing out-of-sample results from the modeling process across different fitting methods.

Usage

1
predictionError(y, yhat)

Arguments

y

the response or actual data series.

yhat

the fitted series.

Value

the RMSE or prediction error = sqrt(mean((y-yhat)^2))

Examples

1
2
3
4
5
6
x <- rnorm(15)
y <- x + rnorm(15)
fit <- lm(y ~ x)
new <- data.frame(x = rnorm(15))
yhat <- predict(fit, newdata = new)
predictionError(y,yhat)

gtog/dMisc documentation built on May 17, 2019, 8:57 a.m.