[R-sig-eco] interpreting adonis results

Gavin Simpson gavin.simpson at ucl.ac.uk
Fri Nov 25 10:41:04 CET 2011


On Sun, 2011-11-20 at 02:24 +0100, Gian Maria Niccolò Benucci wrote:
> Gavin,
> 
> May I ask you if you have tutorial for the betadisper() function?

Nothing more than that which comes with vegan in the help or is
contained in the Vegan tutorial, which can be accessed via:

http://vegan.r-forge.r-project.org/

> Maybe I did a mistake during the identification of the groups of samples...

Yes, I think you did...

> The I tried to use the betadisper( ) function R gave me an error...
> *******************************************************
> > groups <- factor(c(rep(1,12),rep(13,24),
> rep(25,36),rep(37,48),rep(49,60),rep(61,72),rep(73,84),+
> labels=c("SIG","BA","SIMa","SIMb","SZV","BM","BRE")))
> 
> > betadiv <- betadisper(dist1, groups)
> 
> Error: (subscript) logical subscript too long
> 
> *******************************************************
> I can't understand what is wrong...
> Thank you help and patience,

...your code for defining groups is fundamentally flawed; you are
including the labels vector inside the c(....) statement and so R thinks
these are just some more elements of the vector:

groups <- factor(c(rep(1,12), rep(13,24), rep(25,36), rep(37,48), 
                   rep(49,60), rep(61,72), rep(73,84), rep(25,36), 
                   rep(37,48), rep(49,60), rep(61,72), rep(73,84),
                 labels=c("SIG","BA","SIMa","SIMb","SZV","BM","BRE")))

> tail(groups)
labels2 labels3 labels4 labels5 labels6 labels7 
     BA    SIMa    SIMb     SZV      BM     BRE 
Levels: 1 13 25 37 49 61 73 BA BM BRE SIG SIMa SIMb SZV
> nlevels(groups)
[1] 14

I think you want this:

groups <- factor(c(rep(1,12), rep(13,24), rep(25,36), rep(37,48), 
                   rep(49,60), rep(61,72), rep(73,84), rep(25,36), 
                   rep(37,48), rep(49,60), rep(61,72), rep(73,84)),
                 labels=c("SIG","BA","SIMa","SIMb","SZV","BM","BRE"))

> levels(groups)
[1] "SIG"  "BA"   "SIMa" "SIMb" "SZV"  "BM"   "BRE"

Do check that code you use creates the expected results!

HTH

G

> Gian
> 
> 
> 
> 
> 
> 
> 
> 2011/11/17 Gavin Simpson <gavin.simpson at ucl.ac.uk>
> 
> > On Thu, 2011-11-17 at 10:01 +0100, gabriel singer wrote:
> > > ... dangerous wording, there could in fact be a location effect of
> > > 'location' and/or a dispersion effect of 'location'.
> >
> > Well of course, but I was assuming that the assumptions of the test were
> > met! ;-)
> >
> > > Gian, I suggest you add a test of a dispersion effect using the function
> > > betadisper(), then you know a bit more about the type of effect.
> >
> > Indeed, and as the author of that function I too would suggest that the
> > homogeneity assumption be tested.
> >
> > G
> >
> > > gabriel
> > >
> > > On 11/16/11 11:02 PM, Gavin Simpson wrote:
> > > > On Wed, 2011-11-16 at 03:43 +0100, Gian Maria Niccol Benucci wrote:
> > > >> Hi all,
> > > >>
> > > >> I had 84 samples collected in 7 different sites.
> > > >> In each sample were individuated the different fungal species and
> > recorded.
> > > >> I would test if exist a real difference between the sites and if
> > exist a
> > > >> sort of site effect that structure the fungal communities...
> > > >> Then, I did adonis test
> > > >>
> > > >>> adonis(community.sq ~ location, data=env.table, permutations=999)
> > > >> Call:
> > > >> adonis(formula = community.sq ~ location, data = env.table,
> > permutations =
> > > >> 999)
> > > >>
> > > >>            Df SumsOfSqs MeanSqs F.Model      R2 Pr(>F)
> > > >> location   6    12.593 2.09886  6.8867 0.34922  0.001 ***
> > > >> Residuals 77    23.467 0.30477         0.65078
> > > >> Total     83    36.060                 1.00000
> > > >> ---
> > > >> Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1   1
> > > >>
> > > >>
> > > >>
> > > >> The significance is  R2=0.349 at P=0.001
> > > >> Can I assure that exist a strong site effect in structuring the
> > communities
> > > >> in each site?
> > > > Depends. The test is one of no effect of `location`. You have found
> > > > evidence against this hypothesis and thus could reject this hypothesis,
> > > > instead accepting the alternative hypothesis that there is an effect of
> > > > `location`. As to the strength of this effect? ~35% of the sums of
> > > > squares can be explained by `location`. Substantially more of the
> > > > variance remains unexplained. As I know nothing about your subject
> > area,
> > > > I am unable to comment further on the strength of the relationship.
> > > >
> > > > Seeing as many ecologists whose work I read would say an effect is
> > > > significant if the p-value was>= 0.05. Not that I subscribe to this way
> > > > or working, but by that criterion, you have identified a significant
> > > > `location` effect.
> > > >
> > > > HTH
> > > >
> > > > G
> > > >
> > > >> Thanks for helping,
> > > >>
> > > >> G.
> > > >>
> > > >>    [[alternative HTML version deleted]]
> > > >>
> > > >> _______________________________________________
> > > >> R-sig-ecology mailing list
> > > >> R-sig-ecology at r-project.org
> > > >> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> > >
> >
> > --
> > %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> >  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
> > %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> >
> >
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 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