Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

crimcoords

Discriminant coordinates data projection


Description

Compute the discriminant coordinates or crimcoords obtained by projecting the observed data from multiple groups onto the discriminant subspace. The optimal projection subspace is given by the linear transformation of the original variables that maximizes the ratio of the between-groups covariance (which represents groups separation) to the pooled within-group covariance (which represents within-group dispersion).

Usage

crimcoords(data, classification, 
           numdir = NULL, 
           unbiased = FALSE, 
           plot = TRUE, ...)
           
## S3 method for class 'crimcoords'
plot(x, ...)

Arguments

data

A numeric vector, matrix, or data frame of observations. Categorical variables are not allowed. If a matrix or data frame, rows correspond to observations and columns correspond to variables.

classification

A vector (numerical, character string, or factor) giving the groups classification (either the known class labels or the estimated clusters) for the observed data.

numdir

An integer value specifying the number of directions of the discriminant subspace to return. If not provided, the maximal number of directions are returned (which is given by the number of non-null eigenvalues, the minimum among the number of variables and the number of groups minus one). However, since the effectiveness of the discriminant coordinates in highlighting the separation of groups is decreasing, it might be useful to provide a smaller value, say 2 or 3.

unbiased

A logical specifying if unbiased estimates should be used for the between-groups and within-groups covariances. By default unbiased = FALSE so MLE estimates are used. Note that the use of unbiased or MLE estimates only changes the eigenvalues and eigenvectors of the generalized eigendecomposition by a constant of proportionality, so the discriminant coordinates or crimcoords are essentially the same.

plot

A logical specifying if a graph of discriminant coordinates should be produced (default) or not.

x

An object of class crimcoords as returned by crimcoords() function.

...

further arguments passed to or from other methods.

Value

A list of class crimcoords with the following components:

means

A matrix of within-groups means.

B

The between-groups covariance matrix.

W

The pooled within-groups covariance matrix.

evalues

A vector of eigenvalues.

basis

A matrix of eigenvectors specifying the basis of the discriminant subspace.

projection

A matrix of projected data points onto the discriminant subspace.

classification

A vector giving the groups classification.

If plot = TRUE (default) a graph of data points projected onto the discriminant coordinate or crimcoords subspace is also produced.

Author(s)

Luca Scrucca luca.scrucca@unipg.it

References

Gnanadesikan, R. (1977) Methods for Statistical Data Analysis of Multivariate Observations. John Wiley 1& Sons, Sec. 4.2.

Flury, B. (1997) A First Course in Multivariate Statistics. Springer, Sec. 7.3.

See Also

Examples

# discriminant coordinates for the iris data using known classes 
data("iris")
CRIMCOORDS = crimcoords(iris[,-5], iris$Species)
CRIMCOORDS

# banknote data
data("banknote")

# discriminant coordinate on known classes 
CRIMCOORDS = crimcoords(banknote[,-1], banknote$Status)
CRIMCOORDS

#  discriminant coordinates on estimated clusters
mod = Mclust(banknote[,-1])
CRIMCOORDS = crimcoords(banknote[,-1], mod$classification, plot = FALSE)
plot(CRIMCOORDS$projection, type = "n")
text(CRIMCOORDS$projection, cex = 0.8,
     labels = strtrim(banknote$Status, 2), 
     col = mclust.options("classPlotColors")[1:mod$G][mod$classification])

mclust

Gaussian Mixture Modelling for Model-Based Clustering, Classification, and Density Estimation

v5.4.10
GPL (>= 2)
Authors
Chris Fraley [aut], Adrian E. Raftery [aut] (<https://orcid.org/0000-0002-6589-301X>), Luca Scrucca [aut, cre] (<https://orcid.org/0000-0003-3826-0484>), Thomas Brendan Murphy [ctb] (<https://orcid.org/0000-0002-5668-7046>), Michael Fop [ctb] (<https://orcid.org/0000-0003-3936-2757>)
Initial release
2022-05-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.