Description Usage Arguments Value Examples
View source: R/errorcalculation.R
This function calculates the root mean square error and checks that the idenifiers match. Note that if n=1, then the root mean square error is equivalent to the average error. This function can only be used for proportions.
1 | rmse(predicted, actual)
|
predicted |
the predictions including the first column with a character vector with idenifiers to check that the rows of predicted and actual match |
actual |
the real result including the first column with a character vector |
the Root Mean Square Error
1 2 3 4 5 6 | predict1 = data.frame(state = c("TX", "GA", "OR"), dem = c(.45, .49, .63), rep = c(.55, .51, .37))
actual1 = data.frame(state = c("TX", "GA", "OR"), dem = c(.42, .48, .62), rep = c(.58, .52, .38))
rmse(predict1, actual1)
predict2 = data.frame(state = c("OK", "MS", "WY"), dem = c(.42, .44, .3), rep = c(.56, .55, .7), other = c(0.02, 0.01, 0))
actual2 = data.frame(state = c("OK", "MS", "WY"), dem = c(.41, .38, .3), rep = c(.55, .58, .69), other = c(0.04, 0.04, 0.01))
rmse(predict2, actual2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.