[R-sig-eco] FW: Doing repeated measure manova w adonis

JOHN S BREWER jbrewer at olemiss.edu
Sun Aug 10 19:07:35 CEST 2014


________________________________________
From: Steve Brewer [jbrewer at olemiss.edu]
Sent: Sunday, August 10, 2014 12:04 PM
To: JOHN S BREWER
Subject: Doing repeated measure manova w adonis

Hi Folks,

After receiving a few requests regarding doing repeated-measures and split-plot analyses using adonis and species composition data using non-Euclidean distances (e.g., Bray-Curtis distance), I have provided a description of how I have analyzed some plant species composition data in a randomized complete block design with repeated measures.

This approach is similar to that described by Sharon Graham previously for doing a split-split plot permanova, but does not require the use of nestednpmanova. As such, this is a more general approach, which can accommodate block designs and CRDs.

I'm an R novice. So, I cannot vouch for whether the approach outlined below is the most efficient. I just know that it works for me.

Any comments (and criticisms) are welcome.

I used R version 3.1.1 (2014-07-10)—“Sock it to Me” and the vegan 2.0-10 package


#The experimental design – A randomized complete block design with two blocks (site 1 and site 2), two treatment levels (canopy thinning + burning vs. control) and measurements in five different years for a total of 20 observations (4 plots measured over 5 years). Hence, there is no replication of the site by treatment combinations.

The data set I used included three data files: a species file with all 20 observations called “species.fullmatrix”, a treatment file containing the treatment, site, and year factors and a factor corresponding to the four treatment by site combinations (trtsite) called “treatment.fullmatrix”, and a reduced treatment file that contains only 4 observations corresponding to each of the treatment by site combinations and two factors, treatment and site, called “treatment.btwnsub.”

The analysis is done in two parts – the between subjects test and the within subjects test. I do the between subjects test first.


> attach(species.fullmatrix)
> attach(treatment.fullmatrix)
>#treatments.fullmatrix looks like this
        [cid:BF77503A-1B0F-4FED-ACFD-9D74F3C25299]
> #make a grouping factor out of the treatment by site factor
> trsitegrp<-factor(trtsite)
> #generate a bray-curtis distance matrix from the species.fullmatrix file
> specdist<-vegdist(species.fullmatrix, method="bray")
> #run betadisper(). The purpose here is not to do a test for homogeneity of dispersion among groups or to calculate beta diversity. Rather it is to calculate the centroids for each treatment and site combination in Euclidean space while preserving the original bray-curtis distances.
> betadispresults<-betadisper(specdist,trsitegrp, type = "centroid")
> #create an object of the centroids
> centroids.btwn<-betadispresults$centroids
> #The resulting object contains values for each treatment and site combination for each PCO axis.
> #obtain and attach a factor file with 4 observations, one for each treatment by site combination, “treatment.btwnsub”
>attach(treatment.btwnsub)
> treatment.btwnsub

  treatment       site
1   control        site1
2   control        site2
3   treated        site1
4   treated        site2

> #run permanova on the reduced dataset of centroids to test between subjects effects, assuming a randomized complete block design; make sure to use Euclidean distances, not Bray-Curtis distances
> perMOVbtwn<-adonis(centroids.btwn~treatment+site,treatment.btwnsub, method = "euclidean")
> perMOVbtwn

Call:
adonis(formula = centroids.btwn ~ treatment + site, data = treatments.btwnsub,      method = "euclidean")
[cid:4D1999E4-B333-4CC2-8CC9-7977DFF23853]

#If there had been replication, I suppose I could have used strata to define the blocks and then define a grouping variable corresponding to the replicates of the block and treatments, but I have not tried that.

If the design were completely randomized (rather than a randomized block design) such that the treatment and control were assigned to the sites randomly, without restriction, you would proceed as above, except that the adonis model statement would lack the “site” term. It would look as follows:

> perMOVbtwn2<-adonis(centroidsbtwn~treatment,treatments.btwnsub, method = "euclidean")
> perMOVbtwn

Call:
adonis(formula = centroidsbtwn ~ treatment, data = treatments.btwnsub,      method = "euclidean")

Terms added sequentially (first to last)
[cid:A9A79CC8-9CD8-49FE-8EC5-7E5AB337E797]


#Now do the within subjects analysis
#attach the original factors file

> attach(treatment.fullmatrix)

>#Run a permanova to test the within subjects effects. Be sure to include the trtsite variable, which will account for the between-subjects variation, but disregard the results of that test. This time use Bray-Curtis distances, not Euclidean distances.

> perMOVwthn<-adonis(species.fullmatrix~trtsite+year+year:treatment,treatment.fullmatrix, method = "bray")
> perMOVwthn

Call:
adonis(formula = species.fullmatrix ~ trtsite + year + year:treatment,      data = treatments.fullmatrix, method = "bray")


[cid:055420CA-7BAB-4357-926C-B8323FC75F92]


#The trtsite term removes the between-subjects variation from the residual error term, which is the correct error term for testing the year effect and the year by treatment interaction. Ignore the test of trtsite.


Steve


J. Stephen Brewer
Professor
Department of Biology
PO Box 1848
 University of Mississippi
University, Mississippi 38677-1848
 Brewer web page - http://home.olemiss.edu/~jbrewer/
FAX - 662-915-5144 Phone - 662-202-5877


More information about the R-sig-ecology mailing list