0

Consider this data frame:

set.seed(123)
dat1 <- data.frame(Loc = rep(letters[1:20], each = 10),
                   ID = 1:200,
                   var1 = rnorm(200),
                   var2 = rnorm(200),
                   var3 = rnorm(200),
                   var4 = rnorm(200),
                   var5 = rnorm(200),
                   var6 = rnorm(200))
dat1$ID <- factor(dat1$ID)

I am working with data that has a similar structure to dat1 created above. Measurements of multiple variables var1:6 were taken on individuals that were randomly sampled from 20 populations, represented here by the Loc column. I have conducted omnibus non-parametric tests (Kruskal Wallis, some other iterative procedures) on the data with a goal of estimating which Locs differ in which variables. I would like to do pairwise comparisons between Locs using a Dunn's test (for each var), and visualize where the "significant" results are. My issue is, with this many groups (and a lot of significant differences), any approach at visualizing this with a typical boxplot with lines connecting the significant differences is just messy and hard to comprehend. Is there a better approach to visualize pairwise comparisons with this many groups (specifically with a Dunn's test)?

Ryan
  • 1,048
  • 7
  • 14
  • 1
    use something like a correlation plot (tiles), you could then display all pairwise significance values. – tjebo Jun 29 '20 at 08:22
  • @Tjebo this is a good suggestion, I have been looking for a way to do this. Do you know of any packages/methods that would make it easy to convert a data frame with p values obtained from a Dunn’s test into a format that will work for a correlation plot or heat map? The corrplot package is awesome, but I’m not sure how to apply it with non-correlation data? – Ryan Jun 29 '20 at 15:03
  • you just need to shape it into a matrix... how do you do your dunn test? If you struggle to shape the matrix, we could help you I guess :) – tjebo Jun 29 '20 at 21:04
  • @tjebo Is there any approach on how to do this? I am having the same problem. Adding pairwise significant p values in my boxplot seems like not a good option because I am comparing 40 different groups. I hope you can help me. thanks – Tyler Ruddenfort Sep 08 '21 at 09:01
  • @TylerRuddenfort thanks for getting in touch. if you're stuck with a problem, ideally ask a new question - feel free to link to this thread here, so one knows that it is related. – tjebo Sep 08 '21 at 11:30
  • @tjebo [link](https://stackoverflow.com/questions/69103391/how-to-reshape-a-pairwise-comaprison-into-matrix-and-create-a-correlation-heatma) I created a new question found in this link. I hope you can help. Thank you very much. – Tyler Ruddenfort Sep 08 '21 at 12:47

0 Answers0