Skip to contents

Calculate the Root Mean Square Error (RMSE). The RMSE is the standard deviation of the residuals (prediction errors) and therefore an indicator of how precise the prediction of a specific vote actually is.

Usage

rmse(prediction, observation, na.rm = TRUE)

Arguments

prediction

Predicted value.

observation

Oserved value.

na.rm

Remove NA values, defaults to TRUE

Value

A vector of numeric values.

Examples


# Set seed for reproducibility
set.seed(42)

pred_data <- predict_votes(c("Eidg1", "Kant1"), vote_data, exclude_votes = TRUE)

pred_data$rmse <- rmse(pred_data$pred, pred_data$real)