# Clustering based on correlations between survey questions

I'm trying to analyze a survey and find the questions that are most often answered in the same way. There are 29 questions, and I have a matrix with the correlations between each pair of variables. I want to group them into clusters, but cluster analysis isn't something I've ever done, so I was hoping someone had some advice.

My idea was to look at each possible combination of variables, and for each variable in the group, calculate the average of the correlations between that variable and each other in that group, and the average of the correlations between that variable and each variable out of the group. Then take the difference between the in-group and out-group values, and then average the differences for each variable. The combination for which that value is maximized is my first cluster, and then I would repeat the process on the remaining variables a few times until I had several good clusters.

The first problem I see with that is practical -- there's 2^29 = ~537 million combinations, which might be a little much. The second is that I don't really know that this shows what I'm looking for, since like I said, I don't have much experience with cluster analysis, and there might be a better way. Any advice would be great! I'm working in R, and so if anyone had any thoughts about how to actually implement the method, that would also be welcome, though pseudocode is just fine too.

• You really should read up on cluster analysis then... try hierarchical clustering, with correlation as similarity measure. Show us the dendrogram. – Anony-Mousse Nov 18 '14 at 7:30
• @Anony-Mousse Okay, this was helpful -- hierarchical clustering looks like exactly what I want, with 1-cor(a,b) as the distance measure between any two points. My follow-up question is: are there certain linkage criteria that are better than others? Single-linkage clustering seems bad, since "chained" clusters aren't what I'm looking for, but is there a real difference between using the max distance between two clusters and the average distance between all items? (Those seemed like the most commonly used.) Is it best to just try both and see what clusters are generated? – Henry D Nov 20 '14 at 0:30
• And another question, having tried it out a bit. Is there a way to let the data determine how many clusters I have, rather than determining them beforehand? I feel like the best I can do is look at the data in 2, 3, 4, and 5 clusters and decide which looks best, and that doesn't feel very rigorous. – Henry D Nov 20 '14 at 3:33
• There are heuristics (use search). But I don't think the are very good. Clustering is explorative. you will have to study the outcome, and rerun. There is no such thing as the optimal clustering solution. – Anony-Mousse Nov 21 '14 at 0:36