0

R newbie here, looking to create a forestplot using the results of several model-averaged candidate model sets. I apologize in advance as this is quite an involved question, but I greatly appreciate any advice or code you can share to help me get this visualized!

I've saved model-averaged results from several models(different species) into one CSV that is structured like this:

Species coefficient Estimate Std.Error AdjustedSE zvalue Pr(>z) CI.min CI.max
Mongoose DT_River -0.685705266 0.523246095 0.52963788 1.294668095 0.1954348 -1.734615159 -0.015033231
Mongoose DT_CM 0.166817983 0.335013282 0.338030022 0.493500493 0.621659 -0.185497503 1.359723055
Mongoose DT_Human 0.179868595 0.391709753 0.39388355 0.456654244 0.6479196 0.012027307 1.6520409
Mongoose cbFI -0.050836906 0.210660252 0.213638062 0.237958093 0.8119136 -1.328749428 0.512378572
Mongoose lnMB -0.041905179 0.19077529 0.193659704 0.21638564 0.8286872 -1.255336049 0.532397428
Large Duiker DT_River -1.580215953 0.673519724 0.684880124 2.307288382 0.0210387 -2.922556329 -0.237875577
Large Duiker DT_CM -0.324249972 0.41698415 0.420610517 0.770903149 0.4407643 -1.388148857 0.055833773
Large Duiker lnMB -0.256614391 0.50827175 0.51098689 0.502193688 0.6155313 -1.998775227 -0.107175859

So, as you can see I have multiple species and multiple covariates per species. What I want to do is create a forestplot of only the estimates and the CI.min and CI.max for each estimate, for each species, with each species in a different color. Ideally I'd like to make something like the below using plot_summs or plot_coeffs, but I can't seem to make those functions plot data when it is in the format I have it above.

Forest plot showing beta estimates and std. error for four species and six covariates

ANY help is appreciated!

Tiff-D
  • 25
  • 5
  • if you dput the output which would be used as input for the plot that would be really easy ti build the dataframe – PesKchan Apr 14 '22 at 16:38
  • Hi, thanks for responding! I don't think I understand what you're saying. I do have a dataframe, which is in the table in my question. What I want to know is how to create a forestplot from my dataframe – Tiff-D Apr 14 '22 at 16:55
  • https://stackoverflow.com/questions/49994249/example-of-using-dput this might of use what im trying to say " What I want to know is how to create a forestplot from my dataframe " yes since if you use dput it would be easy to create the data frame – PesKchan Apr 14 '22 at 16:57
  • i tried using your data given but the column are messed up ..so if you can give dput it would be easy to replicate – PesKchan Apr 15 '22 at 07:19
  • oh, I just realized my table was messed up due to | symbols in one of the headers. I have fixed it. – Tiff-D Apr 15 '22 at 19:16

0 Answers0