Description Usage Arguments Value Examples
View source: R/predictionError.R
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.
1 | predictionError(y, yhat)
|
y |
the response or actual data series. |
yhat |
the fitted series. |
the RMSE or prediction error = sqrt(mean((y-yhat)^2))
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.