confus {labdsv}R Documentation

Confusion Matrix

Description

A confusion matrix is a cross-tabulation of actual class membership with memberships predicted by a discriminant function, classification tree, or other predictive model.

Usage

confus(class,fitted)

Arguments

class a vector of (integer) class membership values
fitted a matrix of predicted class memberships

Details

Cross-classifies each sample by actual class membership and predicted membership, computing overall accuracy, and the Kappa statistic of agreement.

Value

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

Note

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.

Author(s)

David W. Roberts droberts@montana.edu http://ecology.msu.montana.edu/droberts

References

http://ecology.msu.montana.edu/labdsv/R

Examples

    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)
    ## Not run: pred <- predict(mod,newdata=brycesite)
    ## Not run: confus(bryceveg$arcpat>0,pred)

[Package labdsv version 1.2-1 Index]