[R] nested repeated measures MANOVA using adonis

Gavin Simpson gavin.simpson at ucl.ac.uk
Tue Aug 11 10:14:54 CEST 2009


On Mon, 2009-08-10 at 23:11 -0400, Kevin Parsons wrote:
> I am trying to apply a permuation-based MANOVA (Anderson 2001) to a set of
> morphological data from three ecomorphs of fish reared under two different
> conditions and measured at two points during ontogeny. I will supply a
> distance matrix based on Procrustes distances calculated outside of vegan.
> 
> I have not found an example of a design such as this for adonis. However, I
> have designed my factors for this test which hopefully will work.
> 
> This design is just to understand the principals of this test, my real data
> set is comprised of over a thousand specimens. Column 1 represents the
> ecomorph, column 2 respresents diet, column 3 represents family (nested in
> ecomorph). This example would have 9 individuals, but being that measures
> are repeated
<snip />
> 
> my factor matrix is called Z, so the call to adonis is

adonis requires the dissimilarity matrix (or community data to be
converted to dissimilarities) to be supplied where you have 'Z'. you
provide the "predictor" variables via the data argument.

> 
> adonis (Z~ecomorph+diet+family(ecomorph) +
> ecomorph*diet+ecomorph*family(ecomorph)+ecomorph*diet*family(ecomorph), data
> =b, permuations =999)

Given the nesting, you might need to use 'strata' in your call. There is
an example in ?adonis that you might be able to adapt to your needs. But
this is just a way of constraining the permutations, whilst you appear
to want to partition the dissimilarity based on ecotype / family.

> 
> However, I'm not confident this is the correct way as I would like time to
> be incorporated as a factor. I have seen the strata command, would this
> allow me to incorporate time by including a column for time in my matrix?
> I'm guessing this is how it would go?
> 
> adonis (Z~ecomorph+diet+family(ecomorph) +
> ecomorph*diet+ecomorph*family(ecomorph)+ecomorph*diet*family(ecomorph),
> strata =b [,"time"], permuations =999)

I think you need to learn a bit more about model formulae. Your formulae
needs to contain the variables/objects you want in the analysis. These
variables will be looked up in (in this case) in the object you provide
as 'data' and if not found there, in the global environment (your
workspace). In the above you haven't provided 'data', and 'Z' is not
your dissimilarities.

You also seem to be trying to suggest nesting in the formula using
family(...), and this is not how you do this - the formula parsing code
will be looking for a function called 'family()' which does exist in
base R but which does not do what you want it to do.

I suggest you contact the auithor of the adonis function in vegan
(see ?adonis for email address), or post a message in the vegan forum

http://r-forge.r-project.org/forum/forum.php?forum_id=194

so that we might follow up and provide more informed help than my
musings above.

HTH

G

> 
> Thank you in advance for any help you may provide. If you have further
> questions please ask.
> 
> best,
> 
> 
> Kevin Parsons
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 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-help mailing list