StirlingCodingClub / studyGroup

Gather together a group to skill-share, co-work, and create community
http://StirlingCodingClub.github.io/studyGroup/
Other
2 stars 1 forks source link

Question: PERMANOVA w/multiple predictors #16

Open AlexSeeney opened 6 years ago

AlexSeeney commented 6 years ago

Hi all, having some trouble getting my head around permanova/adonis. Would really appreciate

Had a request from a reviewer - "could the authors run a PERMANOVA to check what factors have an effect overall on community composition and which explains the most variance".

I have a dataset which is a matrix of invertebrate species and abundances. I have samples taken over two seasons, on six rivers and on four sites per river (so 24 sampling sites per season), and six environmental variables (like shade, conductivity, etc) at every site. Differences in community composition between rivers/sites aren't really interesting as these would be expected, but variation in community composition that is directly due to the environmental predictors definitely is.

The reviewer wants to know what the relative importance of the environmental variables. From what I can see, adonis would do this, so I've tried the following:

adonis(vegdist(perm_data[,16:149]) ~ 
    season*depth.flow.BC*substrate.diversity*conductivity*invasive.cover*
    ch.slope*ch.shade*tree.num, data=perm_data)

perm_data[,16:149] is my species matrix "season" through to "tree.num" are my environmental variables; these are what the reviewer is interested in (and the variance they explain)

The output is huge, so i've attached it as a file. I'm not sure if this is doing what has been asked for though. The fact that each of these factors (and various combinations of them) is significant is not particularly novel, as we have already demonstrated this with models, RDA and seasonal NMDS. Is there a neater way to address the reviewer's question and/or extract the information they are requesting from the code/attached file? Appreciate this is a poorly-structured query but with only a year's experience with R, I'm a little out of my depth!

permanova.txt

bradduthie commented 6 years ago

Hi Alex, and thanks for sending this question to the group! I hope you don't mind my edits above to separate out the code. While PERMANOVA analyses really isn't my expertise, the text file that you added helped a lot.

I think I would need a bit more context to completely understand the reviewer's question, but it sounds like what they're asking for might be answered using the sum of squares column in the output you sent. If, for example, you want to know what proportion of the total variation in the community composition is explained by season, you could calculate 19.216/128.153 = 0.1499458? This could be done for all of the variables and interactions (assuming you want to include all interactions in the model).

AlexSeeney commented 6 years ago

Hi Brad,

Thanks for your response - no problem with the edits at all. Following some other advice I have had since posting yesterday, I have simplified the model by removing interactions and just looking at an additive model instead, which obviously reduces the size of the outputs. I will do as you suggest to put together a more succinct output for the reviewer in our response, thank you.

Alex

MattGuy57 commented 6 years ago

Hi Alex,

I don't know if this is useful or not but I have been playing around with the mvAbund package. In that package you can do multiple GLMs, so your response variable is your species by site matrix and your predictors are season, depth etc. The output can then just be read as a normal GLM. If this sounds useful, let me know and I can send you through some stuff.

Cheers,

Matt