[R] NMDS plot and Adonis (PerMANOVA) of community composition with presence absence and relative intensity
Jari Oksanen
jari.oksanen at oulu.fi
Fri Sep 9 12:55:36 CEST 2011
Markus Lindh <markusvlindh <at> gmail.com> writes:
>
> Hi!
>
> Thanks for providing great help in R-related statistics. Now, however I'm
> stuck. I'm not a statistics person but I was recommended to use R to perform
> a nmds plot and PerMANOVA of my dataset.
>
> Sample(treatment) in the columns and species (OTU) in the rows. I have 4
> treatments (Ambient Temperature, Ambient temperature+Low pH, High
> temperature, High temperature+low pH), and I have 16 different species
> (OTUs).
>
> Firstly I want to make a nmds plot and see how different the treatments are.
> Meaning how the species covaries with the environment, I can produce a plot
> but don't understand how to interpret it and I get an error message. Then I
> want to make a PerMANOVA analysis comparing the different treatments with
> each other.
>
> I tried to look at similar problems but I get error messages.
>
> Any ideas?
What kind of error messages do you get? I don't see any in your message.
You get one "Warning message", but that is not an error (difference
between warnings and errors are, among other things, that warnings are
called "warnings", and errors are called "errors"). Of course, I cannot
reproduce your analys because I have no clue what is in "day20.txt".
A reproducible example could be useful. Here some comments, though.
1) do not use data.matrix() for the the result of dist() or vegdist().
Several functions expect dissimilarities like returned by dist() and
vegdist() and they may get confused if they get a square data matrix
instead. In this case metaMDS is clever enough to reallize that your
square matrix may be dissimilarities and works correctly, but adonis()
was not quite as clever: it was fooled to think that input was a
data.matrix and calculated dissimilarities on that. So it analysed
dissimilarities of dissimilarities. This may give correct looking
results but they are all wrong. Either give the result of vegdist()
unchanged or give the original data matrix -- both adonis and
metaMDS can handle either. Obviously we must change adonis() so
that it realized when the input is dissimilarity data in disguise
of data.
2) I did not see any error messages, but I saw one warning.
Because you gave dissimilrities between OTUs (?) to metaMDS instead
of the original data, metaMDS() did not know anything about
column variables ("species"), and therefore plot() could
not plot them even if it tried. It warned you about this.
If you want to have even those in your graph, you should use
your data as input (either step3 or step4 -- I have no idea which
one actually makes sense).
HTH, Jari Oksanen
>
> #NMDS
> step1<-read.delim2("day20.txt", row.names=1)
> library(clusterSim)
> step2<-data.Normalization(step1,type="n10")
> step3<-asin(sqrt(step2))*57.3
> step4<-t(step3)
> library(vegan)
> step5<-data.matrix(vegdist(step4,method="bray"))
> step6<-metaMDS(step5, autotransform=FALSE)
> plot(step5)
> Warning message:
> In ordiplot(x, choices = choices, type = type, display = display, :
> Species scores not available
>
> #PerMANOVA
> step1<-read.delim2("day20.txt", row.names=1)
> library(clusterSim)
> step2<-data.Normalization(step1,type="n10")
> step3<-asin(sqrt(step2))*57.3
> step4<-t(step3)
> library(vegan)
> step5<-data.matrix(vegdist(step4,method="bray"))
> attach(step5)
> step6<-adonis(step5~Sample1+Sample2+Sample3,data=step5)
>
> [[alternative HTML version deleted]]
>
>
More information about the R-help
mailing list