confus {labdsv} | R Documentation |
A confusion matrix is a cross-tabulation of actual class membership with memberships predicted by a disciminant function, classification tree, or other predictive model.
confus(class,fitted)
class |
a vector of (integer) class membership values |
fitted |
a matrix of predicted class memberships |
Cross-classifies each sample by actual class membership and predicted membership, computing overall accuracy, and the Kappa statistic of agreement.
produces a list with elements
matrix |
the cross-tabulation matrix |
correct |
the fraction of correctly predicted samples |
kappa |
the value of the Kappa statistic |
legend |
the text legend for the cross-tabulation matrix |
normal-bracket20bracket-normal
Confusion matrices are commonly computed in remote sensing applications, but are equally suited to the evaluation of any predictive methods of class membership or factors.
David W. Roberts droberts@montana.edu http://ecology.msu.montana.edu/labdsv
http://ecology.montana.msu.edu/labdsv/confus.html
data(bryceveg) # returns a data frame of vegetation data data(brycesite) ## Not run: library(tree) ## Not run: mod <- tree(factor(bryceveg$arcpat>0)~ elev+slope+av,data=brycesite) ## End(Not run) ## Not run: pred <- predict(mod,newdata=brycesite) ## Not run: confus(bryceveg$arcpat>0,pred)