A hierarchical clustering of variables using hclust
is performed using
1 - the absolute correlation as a distance measure between tow variables.
corclust(x, cl = NULL, method = "complete")
# S3 method for corclust
plot(x, selection = "both", mincor = NULL, ...)
Object of class corclust
.
Correlation matrix of numeric variables.
Matrix of Cramer's V for factor variables.
Resulting hierarchical hclust
model for numeric variables.
Resulting hierarchical hclust
model for factor variables.
Variable IDs of numeric variables in x
.
Variable IDs of factor variables x
.
Either a data frame or a matrix consisting of numerical attributes.
Optional vector of ty factor indicating class levels, if class specific correlations should to be considered.
Linkage to be used for clustering. Default is complete
linkage.
If "numeric"
, ‘1 - average absolute correlation within cluster’ is plotted,
if "factor"
, ‘1 - minimum Cramer's V within cluster’ is plotted. The default, "both"
,
generates both variations.
Adds a horizontal line for this correlation.
passed to underlying plot functions.
Gero Szepannek
Each cluster consists of a set of correlated variables according to the chosen clustering criterion.
The default criterion is ‘complete
’. This choice is meaningful as it represents the
minimum absolute correlation between all variables of a cluster.
The data set is split into numerics and factors two separate clustering models are built, depending on the variable type.
For factors distances are computed based on 1-Cramer's V statistic using chisq.test
.
For a large number of factor variables this might take some time.
The resulting trees can be plotted using plot
.
Further proceeding would consist in chosing one variable of each cluster to obtain a
subset of rather uncorrelated variables for further analysis.
An automatic variable selection can be done using cvtree
and xtractvars
.
If an additional class vector cl
is given to the function for any two variables their minimum correlation over all classes is used.
Roever, C. and Szepannek, G. (2005): Application of a genetic algorithm to variable selection in fuzzy clustering. In C. Weihs and W. Gaul (eds), Classification - The Ubiquitous Challenge, 674-681, Springer.
plot.corclust
and hclust
for details on the clustering algorithm, and
cvtree
, xtractvars
for postprocessing.
data(iris)
classes <- iris$Species
variables <- iris[,1:4]
ccres <- corclust(variables, classes)
plot(ccres, mincor = 0.6)
Run the code above in your browser using DataLab