# Cluster analysis with two multi-choice nominal variables

I have a survey that has two questions:

• Which are your preferences ($p$)? (possible answers $p_1$, $p_2$, $p_3$, $p_4$, $p_5$)
• Which services ($s$) do you use? (possible answers $s_1$, $s_2$, $s_3$)

Both questions are multiple choice. So for each person there is a result like

• $p=\{p_1, p_2, p_5\}; s=\{s_2\}$
• $p=\{p_1, p_3\}; s=\{s_1, s_3\}$
• $p=\{p_1, p_4\}; s=\{s_3\}$

Or represented as vectors

• $p=(1, 1, 0, 0, 1); s=(0, 1, 0)$
• $p=(1, 0, 1, 0, 0); s=(1, 0, 1)$
• $p=(1, 0, 0, 1, 0); s=(0, 0, 1)$

My goal is to do cluster analysis to find relations between the preferences and the use of services. How can I determine the distance/similarity between two persons?

• Do you want to say that you want to measure an association between categories of p and categories of s? If yes, can simply frequency 5x3 table be the basis of your analysis? You could do correspondence analysis to display the associations within the table. Commented Oct 12, 2017 at 9:51
• @ttnphns At first sight, correspondence analysis looks like it could be a solution. Commented Oct 12, 2017 at 12:03

It will depend on a) what you want to do, b) how much data you have and c) how it is distributed. There are $2^5 = 32$ possible patterns for preferences and $2^3 = 8$ for services. If you have enough data that all patterns are represented fairly well, then you can treat each of the patterns as a level of a nominal variable. Then you can use methods for nominal variables.

However, I'm not sure that's a good method even if you do have enough data. I think, in this case, you want to define your own distance function based on substantive knowledge of the particular preferences and services. Depending on your purposes and the exact nature of the questions, it might be that you simply want to use a count of preferences and services; or it might be that certain services or preferences are more or less important.

Is (1,0,0,0,0) just as far from (0,1,0,0,0) as it is from (0,0,1,0,0)? It depends on the details.

What would be a good clustering here?

I don't see how you could define a meaningful optimization criterion besides merging identical records.

However, you should look into association rules.

• Yeah, I had this idea as well. I'm currently looking into frequent pattern mining. Commented Oct 12, 2017 at 12:02