Measuring accuracy with score functions
Now that we have checked our model's assumptions, we turn toward measuring it's predictive power. To measure our predictive accuracy, we will use two methods, one for numerical data (Proportion
) and the other for categorical data (Vote
). We know that the Vote
variable is a transformation from the Proportion
variable, meaning that we are measuring the same information in two different ways. However, both numerical and categorical data are frequently encountered in data analysis, and thus we wanted to show both approaches here. Both functions, score_proportions()
(numerical) and score_votes()
(categorical) receive the data we use for testing and the predictions for each of the observations in the testing data, which come from the model we built in previous sections.
In the numerical case, score_proportions()
computes a score using the following expression:

Here, Y_i
is the real response variable value for the ith observation in the testing data, Y'_i
is...