To generate error/classification confusion matrices, follow these steps:
- First, create and display a two-way table based on the Actual and Predicted values:
> tab <- table(cp$Perf, cp$Pred, dnn = c("Actual", "Predicted")) > tab Predicted Actual Low Medium High Low 1150 84 98 Medium 166 1801 170 High 35 38 458
- Display the raw numbers as proportions or percentages. To get overall table-level proportions, use the following code:
> prop.table(tab) Predicted Actual Low Medium High Low 0.28750 0.02100 0.02450 Medium 0.04150 0.45025 0.04250 High 0.00875 0.00950 0.11450
- We often find it more convenient to interpret row-wise or column-wise percentages. To get row-wise percentages rounded to one decimal place, you can pass ...