Markus Lindh
2011-Sep-09 09:42 UTC
[R] NMDS plot and Adonis (PerMANOVA) of community composition with presence absence and relative intensity
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? #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]]
Jari Oksanen
2011-Sep-09 10:55 UTC
[R] NMDS plot and Adonis (PerMANOVA) of community composition with presence absence and relative intensity
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]] > >
Markus Lindh
2011-Sep-12 10:14 UTC
[R] NMDS plot and Adonis (PerMANOVA) of community composition with presence absence and relative intensity
How can I display a heatmap.2 with a column dendrogram without reordering neither column or row? library(vegan) dissimilaritymatrix<-data.matrix(vegdist(step3,method="bray")) library(gplots) heatmap<-heatmap.2(dissimilaritymatrix,dendrogram="column",Colv=T, Rowv=F,key=TRUE, symkey=FALSE, density.info="none", trace="none",col cm.colors(256)) Please advice! [[alternative HTML version deleted]]