6
$\begingroup$

I am trying to validate hierarchical cluster analysis result following a paper by Guy Brock, et al. clValid: An R Package for Cluster Validation (pdf). Do I have to use all these methods? What are the most common validation methods? Also I am stuck at the following code:

emp <- as.matrix(emp)
library(clValid)
intern <- clValid(emp, 4:10, clMethods = c("hierarchical", "kmeans", "diana", "fanny", 
                                           "som", "pam", "sota", "clara", "model"), 
                  validation = "internal")
summary(intern)

Error in if (xx != 0) xx/10 else z/10 : argument is of length zero
In addition: There were 50 or more warnings (use warnings() to see the first 50)

How to deal with the zeros in the matrix?

$\endgroup$
3
  • $\begingroup$ I've just checked the paper you mention. This isn't a GIS or spatial based analysis question. $\endgroup$
    – Andrew Tice
    Jul 18, 2013 at 5:24
  • 2
    $\begingroup$ I agree, this is more appropriate for Cross Validate. But a word of advice; you need to write a question that provides a reproducible example. Nobody knows what "emp" looks like making it is difficult to provide relevant advice. $\endgroup$ Jul 18, 2013 at 14:27
  • $\begingroup$ Are the zeros in the matrix missing values? Are there many zeros (sparse matrix)? $\endgroup$ Dec 17, 2013 at 5:59

2 Answers 2

3
$\begingroup$

This is definitely not a question for this site. I flagged it to be migrated to c-v. What do you mean by "do I have to use all these methods"? because in your code you added all the clustering techniques: k-means, hierarchical, self organizing maps. But at the beginning of the question you said you wanted to perform hierarchical clustering. Anyways, It's all there in the paper you mention.

If I were you I would first do the internal validation. The techniques described usually account for the internal variance of the clusters, meaning that you are aiming to find clusters which are as "homogeneous" as possible. Be wary that these can be affected by the nature of the variables you are using to cluster. If you have only continuous variables then an appropriate choice for the distance on which the hierarchical clustering will be based on would be the euclidean distance which is fitting for the idea of internal variation. Equipped with another distance hierarchical clustering can even cluster mixed type variables but the internal variation here can become more complex. K-means should only be applied on continuous variables so these techniques are often used to find an optimal number for 'k'. In hierarchical clustering the number of clusters is determined by the cut-off height, thinking about a dendrogram, so the number of clusters you can pick is not arbitrary.

The stability measures are used to determine how solid your clustering is. This is especially useful to distinguish real patterns from spurious ones especially when it comes to clustering algorithms that have a random nature. For example k-means which because of its iterative nature is dependent of the initialization points (the initial k centers from where the algorithm takes off). I have seen stability studies for hierarchical clustering but I have never used them. A quick google search should probably shed some light on this.

The biological validation of which they speak of in the paper you cited is a mystery to me.

$\endgroup$
1
$\begingroup$

Did you try to get any of the warnings? warnings()

Most of the times multiple warnings in the correlation matrix generation are because of the NA cells than because of 0 cells. Check if any of the two columns to be correlated have absolutely no variation so that the correlation coefficient can not be generated.

Another suggestion would be try just HC method first and then dive into each method one at a time. This may be able to spot your error.

Visualizing data beforehand using simple corrplot will help you too. Best luck

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.