[R-sig-eco] Multivariate ANOVA/repeated measures

Gavin Simpson gavin.simpson at ucl.ac.uk
Tue Oct 11 13:54:12 CEST 2011


On Mon, 2011-10-10 at 09:47 -0600, Dave Roberts wrote:
</ snip>
> 
> Nick,
> 
>     I would try something pretty direct.  Any appeal to differences in 
> dissimilarities confounds the effects with the particular 
> dissimilarity/distance matrix you use.  Assuming the samples and species 
> are in the same order, and that the data.frames are the same size, you 
> might try
> 
>  > actual <- sum((ST1-ST2)^2)
> 
> and then permute one of the two matrices numerous times
> 
> res <- rep(NA,999)
> for (i in 1:999) {
>       res[i] <- sum((ST1-ST2[sample(1:nrow(ST2),replace=FALSE),])^2)
> }
> final <- (sum(res <= actual) + 1)/1000
> 
> and see what fraction of the permuted matrices are as similar.
> 
> Hopefully Gavin will weigh in with a better randomization.

I guess it does depend on what is exchangeable under the Null
Hypothesis? I suppose that technically, we should condition the
permutation on the 24 sampling locations. Under the Null, we are
assuming that ST1 and ST2 are equivalent and therefore drawn from the
same population of samples that doing lots of ST2 sampling would produce
if it were repeated many times. However, the samples from an individual
location are not necessarily exchangeable between locations; we need to
respect the clustering inherent in the data.

If the samples for ST1 were collected at the same time, and the ones for
ST2 were also collected together at another time point, we could be very
pedantic and say that all sampling locations "experienced" the same
"time" process and that we have to use the same permutation in each
sampling location. That would suck as then you would only have two valid
permutations; the observed one and the samples in the other order. So we
could perhaps relax that assumption... or give up now :-)

Anyway - if you want to condition the permutation on the sampling
locations in adonis(), include that as a factor via the `strata`
argument and the permutation test will put the samples in random order
within sampling location but allow for different ordering (ST1 then ST2,
or ST2 then ST1) within each location during each permutation. To my
mind this does capture the proposed Null; ST1 and ST2 are exchangeable
as we are testing the hypothesis that they are from the same population,
but samples are not exchangeable between sampling locations as we have
repeated measures.

>     If you do go with a multivariate approach I might try a procrustes 
> analysis of PCO ordinations.

That is a good suggestion, Dave. I would add that this will test the
similarity of the configuration of points in ordination space. adonis()
will test if the two sampling methods are drawn from populations with
the same mean species "composition". These are two different aspects of
the problem. I would probably try both i) adonis() and ii) separate
ordinations of the ST1 and ST2 species matrices followed by a procrustes
rotation of the two configurations - see ?procrustes for the latter.
both need the `strata` argument supplying to get the correct NULL.

> Dave

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-sig-ecology mailing list