# PERMANOVA for Unbalanced Longitudinal Analyses

I'm not sure if this question falls in Cross Validated or Stack Overflow. I am specifically interested in differences in community composition between univariate population groups of a longitudinal microbiome study. However, individuals could provide between 1 and 20 samples at any point during this study period, thereby making the design quite unbalanced. I am using R to do my analyses, and my interpretation of most of the suggestions related to this question that I see online lead me to try the following:

where groupvar is the variable that I'm interested in, and indID is the ID of the participant, within whom the repeated measures arise. However, the resulting model provides results that don't vary at all from just using:

Therefore, I interpret this as the strata argument not doing anything. I have additionally tried using block instead of strata to the same effect. Is it, however, a breakdown of my understanding of PERMANOVA/adonis?

Another method I have tried is to include my indID as another independent variable in my analysis as follows:

...And potentially switching the order such that indID "soaks up" the variation before groupvar has the chance (as that is how I am currently interpreting the fact that order matters when using adonis).

Finally, an alternative method I have been using is to take the first principal coordinate of the ordination and use a linear mixed-effects model to determine if there is any separation at all between the two groups, taking into account the repeated measures. However, this method is obviously severely limited by how much of the variation occurs in the first PC.

• Were you able to figure out the solution? Please let me know how did you handle the repeated measure issue. – Binu sharma Feb 19 at 14:57

The decomposition of dissimilarity into components explained by groupvar shouldn't change whether you use strata or not - if it does then we have a bug in adonis(). strata refers specifically to how the data are permuted when testing the decomposition of "variance" in the dissimilarities due to groupvar.

If you don't use strata then we permute the data randomly and so if your data really do come from $i$ individuals then you will end up with too-liberal a test because your data aren't exchangeable under the null hypothesis of no groupvar effect.

If you specify strata then the random shuffling is restricted within levels of strata.

However, it occurs to me that it is unlikely that groupvar varies within indID, in which case it may not make sense to restrict the permutations that way.

The original adonis() performs sequential tests - as you have observed, and as is the same in Type I sums of squares, order matters. In newer version of vegan, we have adonis2() which implements a different approach to the same MANOVA problem and which has a by argument which will do marginal tests (the effect of x given that y and z are in the model, repeat for all combinations…).

You might want to look at the dbrda() function which allows a + Condition() function in the formula that you could use to remove or account for the effect of subject (indID) prior to investigating the effect og groupvar.

• Thank you so much for your explanation. However, I have a couple of clarifying questions. First, I should expect that my R^2 value would change after taking into account repeated measures, yes? Also, in the instance that groupvar is time or some variable that does vary within indID is that when a blocking scheme is more appropriate? I will additionally take a look at the dbrda() function as it looks quite helpful. Thank you! – ktmbiome Jan 19 '17 at 19:41
• No, the R^2 won't change as that is the observed value of the statistic. The significance of the observed statistic might change depending on how you permute data. Blocking would make sense in the situation you describe, as would conditioning on indID to remove the subject effect prior to analysis. – Gavin Simpson Jan 19 '17 at 21:01