Description Usage Arguments Value Examples
View source: R/errorcalculation.R
This function calculates the root mean square error for each state over a single or multiple years and checks that the idenifiers match. This function can only be used for proportions.
1 | ae_by_state(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 |
a data frame with the state and the average error for that state
1 2 3 4 5 6 | predict1 = data.frame(state = c("TX", "GA", "OR"), dem1 = c(.45, .49, .63), dem2 = c(.55, .51, .37))
actual1 = data.frame(state = c("TX", "GA", "OR"), dem1 = c(.42, .48, .62), dem2 = c(.56, .49, .35))
ae_by_state(predict1, actual1)
predict2 = data.frame(state = c("OK", "MS", "WY"), dem1 = c(.42, .44, .3))
actual2 = data.frame(state = c("OK", "MS", "WY"), dem1 = c(.41, .38, .3))
ae_by_state(predict2, actual2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.