joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
567 stars 187 forks source link

Control for repeat measures in ordinate #925

Open elp9 opened 6 years ago

elp9 commented 6 years ago

Hi,

I am performing a PCoA using ordinate (see below) to see if microbiota differs or not between gut sections that are uninfected or infected with parasites.

CAP ordinate

bray_stomach_samples_ord <- ordinate( physeq = stomach_samples_scale, method = "CAP", distance = bray_stomach_samples, formula = ~ Sample.infection )

anova(bray_stomach_samples_ord)

However, for "Sample.infection" there may be multiple samples from a given individual which may confound results? Is there any way I can control for repeat samples from an individual? To complicate matters the number of repeat samples is not consistent between individuals!

ianartmor commented 6 years ago

Late to the party here, but you can add a term to 'partial out' in your formula, something like this: formula = ~ Sample.infection + Condition(Day)

More info here: https://www.rdocumentation.org/packages/vegan/versions/2.4-2/topics/capscale