Learn R Programming

GrammR (version 1.1.0)

MCError: Misclassification Error

Description

Given the true cluster classification of the samples based on some pre-determined criterion and an estimated cluster membership determined using a clustering algorithm, this function calculates the misclassification error of the algorithm. This measure of dissimilarity between two clustering methods is equivalent to one minus the Rand Index.

Usage

MCError(True, Est)

Arguments

True
A $N \times 1$ vector consisting integer values ranging between 1 and $M$, where $N$ is the number of samples and $M$ is the number of clusters in the true cluster membership .
Est
A vector whose length is the same as True, whose values range between 1 and $K$, where $K$ is the estimated number of clusters.

Value

A numeric between 0 and 1. If the vectors are of unequal lengths, the function returns NA.

References

L. Hubert and P. Arabie (1985) Comparing Partitions, Journal of the Classification 2:193-218.

Examples

Run this code
True <- rep(seq(1,6), rep(5,6))
Est <- rep( seq(1,6), 5);
MCError(True, Est);

## Following is an example of complete mismatch, where the misclassification error is equal to 1.
True <- rep(1,10);
Est <- seq(1,10);
MCError(True, Est)

Run the code above in your browser using DataLab