-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathcrimcoords.Rd
117 lines (93 loc) · 3.91 KB
/
crimcoords.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
\name{crimcoords}
\alias{crimcoords}
\alias{print.crimcoords}
\alias{summary.crimcoords}
\alias{print.summary.crimcoords}
\alias{plot.crimcoords}
\title{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,
\dots)
\method{summary}{crimcoords}(object, numdir, \dots)
\method{plot}{crimcoords}(x, \dots)
}
\arguments{
\item{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.
}
\item{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.}
\item{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.}
\item{unbiased}{
A logical specifying if unbiased estimates should be used for the
between-groups and within-groups covariances. By default
\code{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.}
\item{object, x}{
An object of class \code{crimcoords} as returned by \code{crimcoords()} function.}
\item{\dots}{further arguments passed to or from other methods.}
}
\value{
A list of class \code{crimcoords} with the following components:
\item{means}{A matrix of within-groups means.}
\item{B}{The between-groups covariance matrix.}
\item{W}{The pooled within-groups covariance matrix.}
\item{evalues}{A vector of eigenvalues.}
\item{basis}{A matrix of eigenvectors specifying the basis of the
discriminant subspace.}
\item{projection}{A matrix of projected data points onto the discriminant
subspace.}
\item{classification}{A vector giving the groups classification.}
}
\references{
Gnanadesikan, R. (1977) \emph{Methods for Statistical Data Analysis of Multivariate Observations}. John Wiley 1& Sons, Sec. 4.2.
Flury, B. (1997) \emph{A First Course in Multivariate Statistics}. Springer, Sec. 7.3.
}
\author{
Luca Scrucca \email{[email protected]}
}
%\note{}
\seealso{\code{\link{MclustDR}}, \code{\link{clPairs}}.}
\examples{
# discriminant coordinates for the iris data using known classes
data("iris")
CRIMCOORDS = crimcoords(iris[,-5], iris$Species)
summary(CRIMCOORDS)
plot(CRIMCOORDS)
# banknote data
data("banknote")
# discriminant coordinate on known classes
CRIMCOORDS = crimcoords(banknote[,-1], banknote$Status)
summary(CRIMCOORDS)
plot(CRIMCOORDS)
# discriminant coordinates on estimated clusters
mod = Mclust(banknote[,-1])
CRIMCOORDS = crimcoords(banknote[,-1], mod$classification)
summary(CRIMCOORDS)
plot(CRIMCOORDS)
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])
}
\keyword{multivariate}