categorical {nnDiag} | R Documentation |
Given a reference set of categorical variable observations and its corresponding predictions this function produces the classification confusion matrix, accuracy and kappa coefficient. Accuracy and kappa are given as overall, user's and producer's.
categorical(reference.set, predicted.set, class.names = NULL)
reference.set |
vector of observed values. |
predicted.set |
vector of predicted values. |
class.names |
optional nx2 matrix of class names. The first column being the class numbers with the second column being their corresponding class names. |
Using the optional argument class.names
will insert the name of
each class into the output, otherwise the class numbers extracted from
the reference set are used to identify classes.
Function returns an object of class
"nnDcat"
, which is a list containing the following components:
Confusion.Matrix |
matrix comparing the reference set to the predicted set. The major diagonal is agreement between the two sets. |
Overall.Accuracy |
overall accuracy of the classification. |
Users.Accuracy |
user's accuracy for each class. |
Producers.Accuracy |
producer's accuracy for each class. |
Overall.Kappa |
kappa coefficient of the overall classification. |
Users.Cond.Kappa |
user's conditional kappa coefficient for each class. |
Producers.Cond.Kappa |
producer's conditional kappa coefficient for each class. |
Brian Walters walte137@msu.edu
Hudson, W.D. and Ramm, C.W. (1987) Correct Formulation of the Kappa Coefficient of Agreement, Photogrammetric Engineering and Remote Sensing. 53, 421–422.
Rosenfield, G.H. and Fitzpatrick-Lins, K. (1986) A Coefficient of Agreement as a Measure of Thematic Classification Accuracy, Photogrammetric Engineering and Remote Sensing. 52, 223–227.
Story, M. and Congalton, R.G. (1986) Accuracy Assessment: A User's Perspective, Photogrammetric Engineering and Remote Sensing. 52, 397–399.
data(LuceForgrp) x <- categorical(LuceForgrp$ref.forgrp, LuceForgrp$pred.forgrp) x ## Add class names clsnms <- cbind(c(100,120,380,400,700,800,900,999), c("WRJ Pine", "Spruce/Fir", "Exotic SW", "Oak/Pine", "Elm/Ash/Cottonwood", "Maple/Beech/Birch", "Aspen/Birch", "Nonstocked")) x <- categorical(LuceForgrp$ref.forgrp, LuceForgrp$pred.forgrp, class.names = clsnms) x