Learn R Programming

ManlyMix (version 0.1.15.1)

ClassAgree: Calculates the confusion matrix and number of misclassifications

Description

Calculates the confusion matrix and number of misclassifications.

Usage

ClassAgree(est.id, trueid)

Value

ClassificationTable

confusion table between true and estimated partitions

MisclassificationNum

number of misclassifications

Arguments

est.id

estimated membership vector

trueid

true membership vector

Examples

Run this code

set.seed(123)

K <- 3; p <- 4
X <- as.matrix(iris[,-5])
id.true <- rep(1:K, each = 50)

# Obtain initial memberships based on the K-means algorithm
id.km <- kmeans(X, K)$cluster

ClassAgree(id.km, id.true)

Run the code above in your browser using DataLab