0

I want to create a heat map that graphically shows effect sizes between different outcomes and exposures and if p-values were significant.

I have created one big dataframe containing all exposure-outcomes tests with p-values and effect sizes. The effect direction can be positive or negative. Now, there are great resources to create this for correlation matrices such as corrplot.

I don't get how to do this for effects sizes with different exposures and outcomes.

This would be the sample dataframe. The exposures would be 20 and the outcome 15.

Here is a shortened example. Estimates and p-values made up, so disregard the statical nonsense in the values.

dat
# id Exposure Outcome beta   p-value se      x
# 1  a        1       0.02   0.04    0.001
# 1  a        2       0.52   0.001   0.02
# 1  a        3       0.001  0.54    0.001
# 1  b        1      -0.02   0.09    0.045
# 1  b        2       0.06   0.12    0.03
# 1  b        3      -0.1    0.41    0.09
# 1  c        1      -0.42   0.01    0.08

This is an example of a similar plot using correlation.

correlation heatmap

Quinten
  • 35,235
  • 5
  • 20
  • 53
  • 2
    Sample data please, see https://stackoverflow.com/q/5963269, [mcve], and https://stackoverflow.com/tags/r/info – r2evans Jul 15 '22 at 16:39
  • Thanks, i hope this helps. Estimates are made up but essentially very simple. I tried thinking about including se (standard error) as well, but that makes it even more difficult. – Tom Mueller Jul 15 '22 at 17:37
  • I don't really know what you intend your axes to be; your data doesn't show any comparisons, so I don't know how to square it up. – r2evans Jul 15 '22 at 18:07
  • The comparison is always between exposure and the outcome. The effect size (beta) shows how strong the effect of the exposure is on the outcome and which direction it is (+ or -). I just made them into "a,b,c" for simplicities sake. But the x axes would be the exposures and the y axis the outcomes. This heat map is what im trying to achieve [link](https://ars.els-cdn.com/content/image/1-s2.0-S2212877819307057-gr2.jpg) – Tom Mueller Jul 15 '22 at 18:16
  • `ggplot(dat, aes(Exposure, Outcome)) + geom_point(aes(color = beta, size = p.value))`? – r2evans Jul 15 '22 at 18:43

0 Answers0