[R-sig-eco] Error in lm AND questions on betadisper()

Martin Weiser we|@er2 @end|ng |rom n@tur@cun|@cz
Wed Feb 16 00:42:33 CET 2022


On 08. 02. 22 12:24, Ciraolo, Alessia Caterina wrote:

> 
> 2) I need to run a PERMANOVA analysis with interaction term . However
> before that, I was testing the assumptions with betadisper but I have
> trouble in making the variable "group" in betadisper. Usually, it usually
> consists in a factor or an object with a single level, is it right? But how
> does it work with the interaction term, please?
> Below you can find my code:
> mod3 <- betadisper(distance, group)
> mod3
> anova(mod3)
> 
> permutest(mod3, pairwise = TRUE, permutations = 999)
> 
> perm <- adonis(distance ~ Habitat *Treat, data=BF,
>                 permutations= 9999, method="euclidean")
> perm
> 

Dear Alessia,

I cannot address the first issue, but with the second I suggest You make 
groups for the Habitat and Treatment combinations (if they are factors, 
of course). So, with habitats A-C and treatments tr1-tr3 you get a new 
factor for grouping, with nine levels: Atr1, Atr2, Atr3, Btr1,...,Ctr3.

And with this, I am much less sure: if one of the pair Habitat/Treatment 
is continuous var. I am not sure - but I would first "extract/offset" 
the signal of the continuous variable, for example by running RDA with 
the continuous variable as the constraint (predictor), using resulting 
scores on the non-constrained axes as the new data to be grouped 
according to the levels of the factor variable. Or, I would detrend each 
variable of the response data separately (running lm with the continuous 
variable (Treat or Hab) as the predictor, and using residuals instead of 
original values). I am afraid that this is not great, because if the 
continuous and the factor variable share some explained variability, you 
force it to "belong" to the continuous predictor.

HTH,
Martin



More information about the R-sig-ecology mailing list