Learn R Programming

fpc (version 2.1-10)

discrcoord: Discriminant coordinates/canonical variates

Description

Computes discriminant coordinates, sometimes referred to as "canonical variates" as described in Seber (1984).

Usage

discrcoord(xd, clvecd, pool = "n", ...)

Arguments

xd

the data matrix; a numerical object which can be coerced to a matrix.

clvecd

integer vector of class numbers; length must equal nrow(xd).

pool

string. Determines how the within classes covariance is pooled. "n" means that the class covariances are weighted corresponding to the number of points in each class (default). "equal" means that all classes get equal weight.

...

no effect

Value

List with the following components

ev

eigenvalues in descending order.

units

columns are coordinates of projection basis vectors. New points x can be projected onto the projection basis vectors by x %*% units

proj

projections of xd onto units.

Details

The matrix T (see Seber (1984), p. 270) is inverted by use of tdecomp, which can be expected to give reasonable results for singular within-class covariance matrices.

References

Seber, G. A. F. (1984). Multivariate Observations. New York: Wiley.

See Also

plotcluster for straight forward discriminant plots.

batcoord for discriminating projections for two classes, so that also the differences in variance are shown (discrcoord is based only on differences in mean).

rFace for generation of the example data used below.

Examples

Run this code
# NOT RUN {
  set.seed(4634)
  face <- rFace(600,dMoNo=2,dNoEy=0)
  grface <- as.integer(attr(face,"grouping"))
  dcf <- discrcoord(face,grface)
  plot(dcf$proj,col=grface)
  # ...done in one step by function plotcluster.
# }

Run the code above in your browser using DataLab