Thanks Jari.

Perhaps I can pose my question slightly differently. In the example I gave
using the dune data, there is an effect of management. How would you go
about finding where the differences among levels are? In this example its
perhaps easy...plot it. But for examples where sites differ substantially
so that treatments within sites are still closer to a site centroid than a
treatment centroid but consistently shifts in one direction in ordination
space?
In that sense, using the custom contrasts is a posthoc procedure, because
having found a significant effect, I tried to find where that difference
originated. I am aware that I only included the first three contrasts, but
I thought that would be enough to give the idea of what I was doing. Having
done all pairwise contrasts I would correct for the multiple comparisons
with Bonferroni or such.

Once you know where the differences are, how would you then go about
finding out what is causing the difference? (This is why I was asking about
the coefficients)

Thanks again,

Alan

--------------------------------------------------
Email: aghaynes@gmail.com
Mobile: +41763389128
Skype: aghaynes


On 27 May 2013 07:27, Jari Oksanen <jari.oksanen@oulu.fi> wrote:

> Alan,
>
> A few comments on your procedure. You have two non-standard things in your
> message: you try to do something that looks like post hoc tests, and you
> use non-standard contrasts. There is nothing post hoc in your post hoc
> tests. What you do is that you break your factor variable into separate
> contrasts. If do so, you should carefully read the adonis output which says
>
> "Terms added sequentially (first to last)"
>
> If your contrasts are correlated, like they are in the example you gave,
> the results for individual terms will depend on the order of terms. Usually
> people associate post hoc tests with multiple testing problem, but there is
> nothing about that in the example you gave. It is just simple testing of
> individual contrasts.
>
> Second point is that you used non-standard contrasts. The species
> coefficients will depend on contrasts and therefore they change. There are
> easier way of doing the same. For instance, you seem to want to have sum
> contrasts, but with different baseline level. Check functions like
> model.matrix, contrasts, relevel, and as.data.frame. However, the magnitude
> of coefficient also depends on specific contrasts that you use.
>
> Cheers, Jari Oksanen
>
> On 24/05/2013, at 16:48 PM, Alan Haynes wrote:
>
> > Hi all,
> >
> > Im using adonis for some plant community analysis and have been following
> > theBioBucket example of how to posthoc tests (
> >
> http://thebiobucket.blogspot.ch/2011/08/two-way-permanova-adonis-with-custom.html
> > )
> >
> >
> >
> > data(dune)
> > data(dune.env)
> > ad1 <- adonis(dune ~ Management, data=dune.env, permutations=99)
> > # Call:
> > # adonis(formula = dune ~ Management, data = dune.env, permutations = 99)
> > #
> > # Terms added sequentially (first to last)
> > #
> > # Df SumsOfSqs MeanSqs F.Model      R2 Pr(>F)
> > # Management  3    1.4686 0.48953  2.7672 0.34161   0.01 **
> > # Residuals  16    2.8304 0.17690         0.65839
> > # Total      19    4.2990                 1.00000
> > # ---
> > #      Signif. codes:  0 Ś***‚ 0.001 Ś**‚ 0.01 Ś*‚ 0.05 Ś.‚ 0.1 Ś ‚ 1
> >
> > man <- dune.env$Management
> > contmat <- cbind(c(1,-1,0,0), c(1,0,-1,0), # construct a new contrast
> matrix
> >                 c(1,0,0,-1), c(0,1,-1,0),
> >                 c(0,1,0,-1), c(0,0,1,-1))
> > contrasts(man) <- contmat[,1:4]
> > trt1.2 <- model.matrix(~ man)[,2]
> > trt1.3 <- model.matrix(~ man)[,3]
> > trt1.4 <- model.matrix(~ man)[,4]
> >
> > ad2 <- adonis(dune ~ trt1.2 + trt1.3 + trt1.4 )
> > # Call:
> > #      adonis(formula = dune ~ trt1.2 + trt1.3 + trt1.4)
> > #
> > # Terms added sequentially (first to last)
> > #
> > # Df SumsOfSqs MeanSqs F.Model      R2 Pr(>F)
> > # trt1.2     1    0.1483 0.14827  0.8381 0.03449  0.545
> > # trt1.3     1    0.8371 0.83712  4.7321 0.19472  0.001 ***
> > # trt1.4     1    0.4832 0.48321  2.7315 0.11240  0.032 *
> > # Residuals 16    2.8304 0.17690         0.65839
> > # Total     19    4.2990                 1.00000
> > # ---
> > # Signif. codes:  0 Ś***‚ 0.001 Ś**‚ 0.01 Ś*‚ 0.05 Ś.‚ 0.1 Ś ‚ 1
> >
> >
> > I was just wondering whether it was fair to say that the species with
> high
> > coefficients (adonis(...)$coefficients) were the ones causing that
> > difference?
> >
> > ad2$coefficients[3,abs(ad$coefficients[3,])>1]
> > # Elepal    Poapra    Salrep    Poatri    Elyrep    Lolper    Alogen
> > # -1.091667  1.975000 -1.375000  3.283333  1.333333  3.000000  1.650000
> >
> > If so, would it be better to take the coefficients from the original
> model
> > or the model used for the contrast, as these yield different results:
> >
> > ad1$coefficients[3,abs(ad1$coefficients[3,])>1]
> > # Rumace   Tripra   Poatri   Plalan
> > # 2.316667 1.350000 1.516667 1.541667
> >
> >
> > Cheers,
> >
> > Alan
> >
> >
> > --------------------------------------------------
> > Email: aghaynes@gmail.com
> > Mobile: +41763389128
> > Skype: aghaynes
> >
> >       [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-ecology mailing list
> > R-sig-ecology@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
> --
> Jari Oksanen, Dept Biology, Univ Oulu, 90014 Finland
> jari.oksanen@oulu.fi, Ph. +358 400 408593, http://cc.oulu.fi/~jarioksa
>
>
>
>

	[[alternative HTML version deleted]]

