I have a data frame with presence of symptoms which are categorical data (1 = present, 0 = absent). For instance:

abd_pain <- c(0,0,1,1,1)
headache <-c(0,0,1,0,1)
constipation <- c(1,0,1,1,0)
df <- data.frame(abd_pain,headache, constipation)

I wonder what kind of statistical method and graph type use to clearly present the associations between the symptoms? I was considering

  • correlation plot (R Spearmann)
  • or contingency tabel (Chi-square test)


I have ~20 symptoms to visualize

  • $\begingroup$ How about a distance metric, such as Manhattan? You can draw a dendrogram. $\endgroup$ – user2974951 Aug 9 at 10:28
  • $\begingroup$ Do you mean this: stackoverflow.com/questions/48666059/… ? What kind of information represents the numbers in each box? $\endgroup$ – Mikołaj Aug 9 at 10:46

Here is an example in R, using the iris data set. I will estimate a distance matrix on the columns using the Manhattan distance, this is your (di)simmilarity matrix, where lower values mean that the variables are more similar, higher values mean they are not very similar.


which looks like this

             Sepal.Length Sepal.Width Petal.Length
Sepal.Width         417.9                         
Petal.Length        312.8       301.7             
Petal.Width         696.6       278.7        383.8

Now I'll use hierarchical clustering to group variables together and get a plot.


enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.