4
$\begingroup$

Is there any way to perform pairwise ANOVA test from Constrained ordination for multiple factors in a variable?

e.g. I am trying to figure out whether microbial communities among five plant genotypes are different in their composition. I am performing constrained ordination using capscale using 'vegan' package in R.

My model is like this: (in R code)

    CAP=capscale(vegdist(asv_tab,method ="cao")~
                    Condition(Experiment)+Genotype+Condition(plate),
                    data = metadata)

Here I am removing the effect of experiment and plates using Condition and I am interested in plotting the effect of Genotypes on microbial communities.

When I run anova(CAP,permutations=999), I'm getting only the effect of genotype as a factor, but not individual genotypes. If I want to retrieve the results of individual comparison of each levels of the genotype, is there any command in this constrained ordination?

Appreciate your help!

$\endgroup$
1
  • 1
    $\begingroup$ How many Genotypes you have? (There is an answer if you have only two Genotypes.) $\endgroup$ May 18, 2022 at 7:18

2 Answers 2

2
$\begingroup$

There is no way to do this without extensive own programming. Or there are, but they are either ways you do not want to have, or are not correct. For factor variables the permutation test (anova) only gives the effect of the factor, not its individual levels.

Firstly, permutest function has one type of test that you do not have in anova for constrained ordination: argument by = "onedf" will give you sequential test of one-degree-of-freedom contrasts of factors. However, you probably do not want to have sequential tests that compare each contrast to previous levels, and with default contrasts, the first given effect is the corner-point contrast to the first level of your factor (and the first level will not appear in the results)

Secondly, function coef will give you the regression coefficients of single contrasts for each axis (and what you get will depend on the type of your contrasts), but you should also get the standard deviations of these coefficients to get their significance. Moreover, even if you get the sd's, there is a coefficient for each effect for each axis, but no overall test over all axes. There is function vcov that can get you Canoco-type estimates of standard deviations of coefficients, but the theoretical basis of these sd's is lacking and I would not trust them (but provide them in vegan). See the Example in help(vcov.cca) for calculation of this kind of "t-values".

Third alternative is to use each factor level – Genotype) in your case – as a separate two-level factor variable in model fitting. Easiest way is to use something as data.frame(model.matrix(~ Genotype, data=metadata)) to get the data frame with Genotype split to one-df contrasts. Type of contrasts (see help(contrasts)) will again rule what kind of data frame you get. What ever way you define your contrasts and data frames, you will get one less effects than the levels of your factors. So for five genotypes you can get only four effects. That's a mathematical necessity you cannot circumvent in linear matrix algebra like in constrained ordination.

I suggest you use dbrda instead of capscale. Basically similar, but dbrda handles non-Euclidean distances (such as Cao) whereas capscale is more approximate. Second, the argument for selecting distance function is distance. If you use method like in your example, it will be ignored and Euclidean distances will be used – but that you see in the output that will tell you the type of distances, for instance as Inertia is squared Cao distance, but with method = "cao" it reads Euclidean.

$\endgroup$
2
  • $\begingroup$ Thanks @Jari for your detailed answers. I was going through an article and they have used t-test adjusted p-values (individually for CAP coordinates of my samples) to find pairwise comparison significance. I would like to know if you think this is also an alternative way of finding significance between pairs. $\endgroup$
    – Arijit
    May 20, 2022 at 2:00
  • $\begingroup$ does this answer apply to any constrained ordination? e.g. RDA and CCA $\endgroup$ Feb 27, 2023 at 20:00
0
$\begingroup$

And what about using Multivariate Analysis of Variance Using Distance Matrices (i.e. function adonis in the package vegan) followed by a wrapper function pairwise.adonis?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.