Confusion matrix

A confusion matrix (also known as an error matrix or contingency table) visually represents the difference between the actual and predicted classifications of a model. It is used to easily recognize how often a classification system mislabels one classification as another. This is helpful for testing the strength of hypotheses in statistical models by seeing how often the models can reproduce accurate results on further data sets. A confusion matrix shows where the model is actually wrong and where it is correct.

Cartographic Application
In cartography, "An error matrix is frequently employed to organize and display information used to assess the thematic accuracy of a land-cover map" It is commonly used to asses the accuracy of species distribution models (models that predict the locations of certain species based on a specified set of data criteria). That is, the confusion matrix represents how often the model correctly places a species in a given area or recognizes that it will not be found in the area. This helps to ensure that a map based on the species distribution model presents the most accurate information possible.

Example
The confusion matrix is based on the frequency recorded for each of the four possible types of prediction:
 * True positive: presence predicted by model and confirmed by data
 * False positive: presence predicted by the model but data indicates absence
 * False negative: absence predicted by the model but data indicates presence
 * True negative: absence predicted by the model and confirmed by the data

The following table is a basic example of how a confusion matrix deals with frequencies, as adapted from "Species Distribution Model" by Richard Pearson.

Statistical Testing

Notice, the confusion matrix is also set up in a similar manner as a statistical contingency table. This contingency table is necessary for Pearson's chi-square test. Before the "goodness-of-fit" test (that the chi-square calculates) can be completed, observed and expected frequencies must be calculated for insertion into the formula. The confusion matrix(and/or contingency table) is necessary in calculating those observed and expected frequencies, therefore the "goodness-of-fit" of your data cannot be statistically determined without this table.