discr(x, k)
An observation can be classified by computing its Euclidean distance from the group centroids, projected onto a subspace defined by a subset of the canonical variates. The observation is assigned to the closest group.
The cor component of the output is a measure of the ability to discriminate between the groups.
Multivariate planing can be used as an exploratory method to see if (non-linear) discrimination is possible, see mstree.
Dillon, W. R. and Goldstein, M. (1984). Multivariate Analysis, Methods and Applications. Wiley, New York.
Gnanadesikan, R. (1977). Methods for Statistical Data Analysis of Multivariate Observations. Wiley, New York.
Mardia, K. V., Kent, J. T. and Bibby, J. M. (1979). Multivariate Analysis. Academic Press, London.
# discrimination using a grouping variable discr.group <- function(x, group) { size <- table(category(sort(group)) discr(x[order(group),], size) }# a discrimination analysis of the iris data iris.var <- rbind(iris[,,1], iris[,,2], iris[,,3]) iris.dis <- discr(iris.var, 3) iris.dv <- iris.var %*% iris.dis$vars brush(cbind(iris.dv, rep(1:3, c(50, 50, 50))))
iris.x <- iris.dv[,1] ; iris.y <- iris.dv[,2] iris.lab <- c(rep("S", 50), rep("C", 50), rep("V", 50)) plot(iris.x, iris.y, type = "n", xlab = "first discriminant variable", ylab = "second discriminant variable") text(iris.x, iris.y, iris.lab)