classError {mclust}R Documentation

Classification error.

Description

Error for a given classification relative to a known truth. Location of errors in a given classification relative to a known truth.

Usage

classError(classification, truth)

Arguments

classification

A numeric or character vector of class labels.

truth

A numeric or character vector of class labels. Must have the same length as classification.

Details

If more than one mapping between classification and truth corresponds to the minimum number of classification errors, only one possible set of misclassified observations is returned.

Value

A list with the following two components:

misclassified

The indexes of the misclassified data points in a minimum error mapping between the given classification and the given truth.

errorRate

The errorRate corresponding to a minimum error mapping mapping between the given classification and the given truth.

References

C. Fraley and A. E. Raftery (2006, revised 2010). MCLUST Version 3 for R: Normal Mixture Modeling and Model-Based Clustering, Technical Report no. 504, Department of Statistics, University of Washington.

See Also

mapClass, table

Examples

a <- rep(1:3, 3)
a
b <- rep(c("A", "B", "C"), 3)
b
classError(a, b)

a <- sample(1:3, 9, replace = TRUE)
a
b <- sample(c("A", "B", "C"), 9, replace = TRUE)
b
classError(a, b)

[Package mclust version 3.4.11 Index]