Clustering Two Variables With Disease Information I was proposed a problem and I am not quite sure how to go about it. The problem is I want to find a relationship between two variables. For the simplified case there are only two variables, lets say Diabetes and Congestive Heart Failure. Each variables has a $0$ or a $1$, if you do not have the disease or if you do, respectively. 
This was presented to me as a clustering problem. We can see how the clusters form and see which disease is most dominant or just how they relate to each other. My assumption is there would be 4 clusters, cluster 1 is people who have neither, cluster two is people with Diabets, cluster 3 is people with Congestive Heart Failure and cluster 4 is people who have both. 
My questions are:


*

*Is this a valid way to determine a relationship between the variables?

*How would I create the affinity matrix?

*How would I visualize the clusters?


Has anyone has experience with this type of modeling? Any ideas outside of clustering would be appreciated! Any insight or help or references would be highly appreciated! Thank you in advance!
 A: First note that this is not a clustering problem in the usual sense of the word.
The ''clusters'' what you described are actually called contingency table of Diabetes and CHF. To answer your first question, the calculation of this table is surely the first step towards any analysis, as no information is lost in this case if you convert your database to a contingency table. In R you can simply do it (of course by using the variable names of your database ) by
DmChfTab <- table( Database$DM, Database$CHF )
DmChfTab

The real question is how to analyze this table. If you are interested in the relationship of diabetes and CHF, you need a measure of association (in statistical terms), of which there are many. In this case, Pearson $\chi^2$-test for independence, $\phi$-coefficient, contingency coefficient and Cramer's V might be of your interest. You can calculate these in R with
assocstats( DmChfTab )

Note that assocstats requires the package vcd.
As for your second question, I don't know what do you mean by ''affinity matrix'', it's perhaps just the same as contingency table (as a matrix).
Finally, to visualize the contingency table, you might consider
mosaic( DmChfTab )

(also from vcd) or, as a more advanced tool, assoc( DmChfTab ) (also from vcd).
