# Meaning of this Cluster Analysis

I have 801 households (or customers). I have say 100 features on which I will describe a customer.

I have a feature map with me. I now apply K Means algorithm for the value of K say 6. I get 6 clusters as the output.

Now, I want to understand the unique household features describing these clusters. I have 7 demographic features of all these households.

How should I approach ? How to find dominating household features in all the clusters to understand why these households cluster this way ?

Your question is slightly unclear to me. I understand you have 100 individuals, measured across 7 variables, and clustered into 6 clusters(?) Now you want to see how these clusters compare by each variable.

Basic method to compare clusters using boxplots:

You can compare clusters by variables with boxplots. They should be organised like this: Each boxplot represents a variable, so there will be 7 boxplots. They have the 6 clusters along the X axis, and the quantity of that variable along the y axis.

To demonstrate, I'll generate some data to be clustered into 6 clusters (only 2 dimensions rather than your 7 for simplicity)

n = 1000
g = 8
set.seed(g)
d <- data.frame(x = unlist(lapply(1:g, function(i) rnorm(n/g, runif(1)*i^1.5))),
y = unlist(lapply(1:g, function(i) rnorm(n/g, runif(1)*i^1.5))))
plot(d) Now we'll cluster it in R using the default kmeans function.

k <- kmeans(d, 6, nstart=25, iter.max=1000)
plot(comp, col=k$clust, pch=16) So now we want to compare the clusters across each variable (only 2 in this case). The first boxplot would be comparing the clusters by their x-values. boxplot(d$x ~ k$cluster, xlab='Cluster', ylab='x-value') And then you do it for the next variable, the y-values. boxplot(d$y ~ k$cluster, xlab='Cluster', ylab='y-value') And yeah, you can compare the clusters visually. These boxplots in the pictures are meaningless but maybe you'll see that for 5 of your variables, the boxplots mostly overlap (so those variables hardly matter to the clustering), while there are 2 variables where the boxplots show little overlap (so those are the 2 variables that distinguish the households from each other). There are more objective statistical methods for comparing the boxplots than just by looking too, you can find those by a quick search. (Note, I gave the default R functions above to plot these, but I actually used ggplot for nicer looking plots) n = 1000 g = 8 set.seed(g) d <- data.frame(x = unlist(lapply(1:g, function(i) rnorm(n/g, runif(1)*i^1.5))), y = unlist(lapply(1:g, function(i) rnorm(n/g, runif(1)*i^1.5)))) ggplot(d, aes(x, y)) + geom_point(size=3, alpha=0.7) k <- kmeans(d, 6, nstart=25, iter.max=1000) vggplot(d, aes(x, y)) + geom_point(alpha=.7, color=k$clust, size=3, pch = 16)

d$clust <- k$cluster

qplot(factor(clust), x, geom = "boxplot", data = d, xlab='Cluster', ylab='x-value') + geom_boxplot(aes(fill = factor(clust))) + theme(legend.position="NULL")


To study the differences between clusters, compute models.

For example, a decision tree is easy to understand. Or you can select discriminative features. You could also try SVMs but these are not particularly easy to understand...