Description Usage Arguments Details Value References See Also Examples
Andrew's plot is an exploratory technique for identifying clusters of similar observations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | andrews(x, ...)
## S3 method for class 'matrix'
andrews(
x,
draw = TRUE,
res = 20,
w = seq(-pi, pi, length = res),
main = "Andrew's plot",
xlab = "t",
ylab = "f(t)",
pch = 1,
lty = 1,
col = 1,
...
)
## S3 method for class 'data.frame'
andrews(x, ...)
## S3 method for class 'data.frame'
andrews(x, ...)
|
x |
numeric matrix, vector or data frame that contains only numeric variables |
... |
other arguments passed to other methods, |
draw |
logical, whether the plot should be produced |
res |
numeric, number of points on which transformed variables are evaluated, see Details |
w |
numeric vector, sequence of points on which transformed variables are evaluated |
main, xlab, ylab, pch, lty, col |
arguments passed to |
Andrew's plot shows each observation in a multivariate data set as a curve over [-pi; pi] interval. Formally, each observation x = (x_1, x_2, ..., x_p) is transformed according to the following formula (from Everitt (1993)):
1/sqrt(2) x_1 + x_2 sin(t) + x_3 cos(t) x_4 sin(2t) + x_5 cos(2t) ...
1/sqrt(2) x_1 + x_2 sin(t) + x_3 cos(t) x_4 sin(2t) + x_5 cos(2t) ...
and plotted against the above mentioned interval. The transformation preserves Euclidean distances so if two curves are identical so are the observations.
By default the functins are evaluated on an equally-spaced interval from
-pi to pi of the length provided by res
.
Custom intervals can be constructed via w
argument.
Other arguments are passed to matplot()
.
Depending on the value of the draw
argument the plot is
produced (default) or not. In both cases the function returns a matrix of
transformed observations invisibly.
Everitt, B. S. (1993) "Cluster Analysis", New York: John Wiley and Sons
Package cluster
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ### Using 'iris' data
d <- iris[1:4]
# Andrew's plots
layout( matrix(1:4, ncol=2) )
# "unsupervised"
andrews(d, lty=1, col=1, main="Andrew's plot of Iris data")
# colored with species
andrews(d, lty=1, col=match( iris$Species, unique(iris$Species)),
main="Andrew's plot of Iris data\n color-coded species")
# Andrew's plot on standardized data
andrews( scale(d), main="Andrew's plot of standardized Iris data")
# Andrew's plot on principal components
pcad <- princomp(d)
andrews( pcad$scores, main="Andrew's plot of PCA of Iris data")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.