[R-sig-eco] Plot NMDS with size of the points related to abundance
Hello list, I am analyzing species composition of weeds in 12 cover crop treatments and a fallow plot. I have been using nmds and got good results and no problems with it (although after some fighting!). My data is a matrix of biomass values sorted by species. Now I'd like to know which of my species are contributing with more biomass to the community in each treatment, that is, I'd like to create a graph such as the one that you get from the option plot (nmds_model, type=t, display=c(species)) but instead of getting just the names of the species, I'd like to see dots of different sizes that would refer to the abundance of each of the species, is that possible at all? I know you can do it with CANOCO but wanted to ask if there is a way to do it in R. I have searched the internet and found something that looks like what I want to do (enclosed to the mail) but haven't found the way to do it. I have already done an Indicator Species Analysis with the multipatt function. That gives me information about the species that are related to some treatments but here I'm just looking for the species with more and less biomass in each treatment. Thank you very much!! Barbara -- Barbara Baraibar Post-doctoral scholar - Weed and Applied Plant Ecology Plant Sciences Department Penn State University University Park, Pennsylvania 16802 web-site:http://www.weedecologypsu.com ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Nested Permanova with repeated measures
Wow- Thank you so much for this!!- I do however have a little confusion on this part- which is well ,most of it (-: If you want to include all weeks and examine the between-subjects effects, then you need to use betadisper() to get the centroid across all 11 weeks for each microcosm. I do indeed want to us all weeks so I did this to get the centroids for each mesocosm: *mc.centroids-betadisper(vegdist(community, method=bray),mesocosm) #get mesocosm centroids * *correct? and now *you say Using a grouping variable (let's call it block.treatment.combo), you can get a new matrix made up of 12 centroids, one for each subject (mesocosm; let's call it community.centroids.among.weeks). Using this matrix of centroids, run the following model: Community.centroids.among.weeks ~ treatment + block I'm afraid I was not able to follow you here! Could you provide the code you would use there? [[alternative HTML version deleted]] ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Plot NMDS with size of the points related to abundance
Dear Roman, Sara and Phil, Thanks so much for your help!! After some playing around with your different options, I got the graph I was looking for (attached). I wasn't using the right words to look for help. Thanks a lot!! Barbara - Original Message - From: Roman Luštrik roman.lust...@gmail.com To: Barbara Baraibar Padro bu...@psu.edu Cc: r-sig-ecology@r-project.org Sent: Tuesday, March 17, 2015 11:42:31 AM Subject: Re: [R-sig-eco] Plot NMDS with size of the points related to abundance After clicking send I remembered that you might want to scale circle sizes according to their area, not radius (which is the default to draw). Then I went to see the link Sarah posted and it deals with this, too (great minds think alike? :) ). Cheers, Roman On Tue, Mar 17, 2015 at 4:39 PM, Roman Luštrik roman.lust...@gmail.com wrote: Assuming you're working with metaMDS from vegan, it's trivial to extract NMDS scores, add some variable and plot the data. The following code would be easy to translate into a generic function. library(vegan) data(dune) sol - metaMDS(dune) # add some variable that will correspond to size of points spc - as.data.frame(cbind(sol$species, mysize = runif(nrow(sol$species pts - as.data.frame(sol$points) library(ggplot2) ggplot(spc, aes(x = MDS1, y = MDS2)) + theme_bw() + geom_point(aes(size = mysize), pch = 1) + geom_point(data = pts, color = red) Cheers, Roman On Tue, Mar 17, 2015 at 4:23 PM, Barbara Baraibar Padro bu...@psu.edu wrote: blockquote Hello list, I am analyzing species composition of weeds in 12 cover crop treatments and a fallow plot. I have been using nmds and got good results and no problems with it (although after some fighting!). My data is a matrix of biomass values sorted by species. Now I'd like to know which of my species are contributing with more biomass to the community in each treatment, that is, I'd like to create a graph such as the one that you get from the option plot (nmds_model, type=t, display=c(species)) but instead of getting just the names of the species, I'd like to see dots of different sizes that would refer to the abundance of each of the species, is that possible at all? I know you can do it with CANOCO but wanted to ask if there is a way to do it in R. I have searched the internet and found something that looks like what I want to do (enclosed to the mail) but haven't found the way to do it. I have already done an Indicator Species Analysis with the multipatt function. That gives me information about the species that are related to some treatments but here I'm just looking for the species with more and less biomass in each treatment. Thank you very much!! Barbara -- Barbara Baraibar Post-doctoral scholar - Weed and Applied Plant Ecology Plant Sciences Department Penn State University University Park, Pennsylvania 16802 web-site: http://www.weedecologypsu.com ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- In God we trust, all others bring data. /blockquote -- In God we trust, all others bring data. -- Barbara Baraibar Post-doctoral scholar - Weed and Applied Plant Ecology Plant Sciences Department Penn State University University Park, Pennsylvania 16802 web-site:http://www.weedecologypsu.com ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[R-sig-eco] Nested Permanova with repeated measures
Hi Stephen and all Permanoverts! Thank you for posting your thoughts about repeated measure Permanova. I am following your methods (From Feb 25 2013- posted below) where you use adonis for the time and time by treatment interaction and , in a seperate step, the BiodiversityR for the main effect. When I run nested.npmanova the p value I get for my treatment is 1.0 leading me to believe there is something wrong- there is of course the possibility that there really is nothing there but when I look at the plots there seems to be some kind of treatment effect at least for 5 of the 10 speciesso if not significant at least not p=1! I will provide a glimpse into the design and data I have in the hopes of finding my issue. Melting permafrost which slumps into Arctic lakes has been associated with phisio-chemical and biological changes in these lakes. To replicate these slumps, I ran an experiment in an unslumped Arctic lake where I dosed mesocosms with melted permafrost soil. The experiment had three replicates of 3 treatment levels plus a control for a total of 12 mesocosms. The experiment was set up in a randomized block design (ie 3 blocks with 4 mesocosms each- one of each treatment). I have zooplankton community data for 11 time steps (weeks). For a number of other univariate parameters I have used a mixed effects model with mesocosm within block as my random terms and treatment and time and their interaction as my main effects. (though I am not really interested in the effect of time) But in multivariate space I think the best I can do is: to test time and its interaction with treatment I have *adonis(community~week*treatment, method=bray, perm=999,strata = enviro$mesocosm, data=enviro) * and to test the main effect: *library(BiodiversityR)* *nested.npmanova(community ~treatment + mesocosm, method=bray, data = enviro) * Does this seem right? I acknowledge that I loose the ability to use block here but not much I can do right? I get this as the result of the nested model in BiodiversityR: *Total sum of squares for non-parametric manova: 26.8071635047485 * *Nested anova for mc nested within t.level * * Df SumsofSquares F N.Perm Pr(F) * *treatment31.4607 0.1727 100 1.00 * *mesocosm 12.8188 15.8910100 0.009901 *** *Residuals 127 22.5277 0.1774 * *---* *Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1* * * Thank you very much Paul Moquin [R-sig-eco] Permanova with nested data*Steve Brewer* jbrewer at olemiss.edu r-sig-ecology%40r-project.org?Subject=Re%3A%20%5BR-sig-eco%5D%20Permanova%20with%20nested%20dataIn-Reply-To=%3CCD50D4BB.1E27D%25jbrewer%40olemiss.edu%3E *Mon Feb 25 16:13:18 CET 2013* - Previous message: [R-sig-eco] lme4 for pseudoreplication avoidance https://stat.ethz.ch/pipermail/r-sig-ecology/2013-February/003594.html - Next message: [R-sig-eco] Validation of linear regression https://stat.ethz.ch/pipermail/r-sig-ecology/2013-February/003597.html - *Messages sorted by:* [ date ] https://stat.ethz.ch/pipermail/r-sig-ecology/2013-February/date.html#3595 [ thread ] https://stat.ethz.ch/pipermail/r-sig-ecology/2013-February/thread.html#3595 [ subject ] https://stat.ethz.ch/pipermail/r-sig-ecology/2013-February/subject.html#3595 [ author ] https://stat.ethz.ch/pipermail/r-sig-ecology/2013-February/author.html#3595 -- Beth and others, Given several recent queries regarding how to analyze repeated-measures and split-plot perManova using adonis, I thought I would pass along what I think is a reasonable solution. I just saw the recent exchange over the use of BiodiversityR to do nested perMANOVA. I was unaware of this function until today. With that in mind, it is possible to do a simple repeated-measures permanova using two different analyses, one for the within-subjects effects and one for the between-subjects effects. The same approach applies to a simple split-plot analysis. For the within-subjects (or sub-plot) effects, you use adonis and the strata function. The model formula could look something like: Assume species responses are in Speciesdata and the treatment, time, and plot effects are in envfactors Adonis(Speciesdata ~ betweensubtrtmt * time + plot, data = envfactors, strata = plot) Where plot is nested within the betweensubtrtmnt Strata restricts the permutation, and the residual error term will give you the correct test for the time effect and the betweensubtrtmnt * time interaction, but the test for the betweensubtrmnt main effect will be wrong because plot, and not the residual error term, is the correct error term for testing it. To get a test for the betweensubtrtmnt main effect, load the BiodiversityR package (I use the 1.6 version, but see the recent discussion about this) and use the nested.npmanova function.
Re: [R-sig-eco] Nested Permanova with repeated measures
Paul, As I think you've figured out, you can't use nested permanova when you have blocks. It is not clear to me why you would have mesocosm included as an effect in the model. My understanding is that you have a randomized block design with no repetitions of treatment by block combinations. Hence, ignoring time and its interactions, the between-subjects effects are block and treatment, and the residual variation is the experimental error term (I.e., the block by treatment interaction term). The model for a given time (week) would simply be community~treatment + block The mesocosm is the experimental unit. So, you don't want to specify it in the model. If you want to include all weeks and examine the between-subjects effects, then you need to use betadisper() to get the centroid across all 11 weeks for each microcosm. Using a grouping variable (let's call it block.treatment.combo), you can get a new matrix made up of 12 centroids, one for each subject (mesocosm; let's call it community.centroids.among.weeks). Using this matrix of centroids, run the following model: Community.centroids.among.weeks ~ treatment + block You should get an anova table containing treatment (3 df), block (2 df), and residual error with (4-1)*(3-1) = 6 df. Total = 11 df. To analyze the within-subjects effects (which must be done in a separate analysis), you use the original matrix (not the matrix of centroids) and construct the following model Community ~ week + week:treatment + block.treatment.combo The block.treatment.combo is the grouping variable that you create from your factors that includes all block by treatment combinations (e.g., b1t1, b1t2, b1t3, b1c, b2t1, b2t2, etc). It will have 11 degrees of freedom (3 blocks x 4 treatments) -1, the same total df for the between-subjects analysis. This factor will account for and remove the between-subjects variation from the residual error (ignore the result of the test of this factor). The resulting anova table should look like this: Block.treatment.combo (11 df; ignore test), time (10 df), time:treatment (30 df), and residual error (80 df). Hope this helps. Steve J. Stephen Brewer Professor Department of Biology PO Box 1848 University of Mississippi University, Mississippi 38677-1848 Brewer web page - http://home.olemiss.edu/~jbrewer/ FAX - 662-915-5144 Phone - 662-202-5877 From: Paul Moquin moquin.p...@gmail.com Date: Tue, 17 Mar 2015 11:42:26 -0700 To: r-sig-ecology@r-project.org, Pyro Maniac jbre...@olemiss.edu Subject: Nested Permanova with repeated measures Hi Stephen and all Permanoverts! Thank you for posting your thoughts about repeated measure Permanova. I am following your methods (From Feb 25 2013- posted below) where you use adonis for the time and time by treatment interaction and , in a seperate step, the BiodiversityR for the main effect. When I run nested.npmanova the p value I get for my treatment is 1.0 leading me to believe there is something wrong- there is of course the possibility that there really is nothing there but when I look at the plots there seems to be some kind of treatment effect at least for 5 of the 10 speciesso if not significant at least not p=1! I will provide a glimpse into the design and data I have in the hopes of finding my issue. Melting permafrost which slumps into Arctic lakes has been associated with phisio-chemical and biological changes in these lakes. To replicate these slumps, I ran an experiment in an unslumped Arctic lake where I dosed mesocosms with melted permafrost soil. The experiment had three replicates of 3 treatment levels plus a control for a total of 12 mesocosms. The experiment was set up in a randomized block design (ie 3 blocks with 4 mesocosms each- one of each treatment). I have zooplankton community data for 11 time steps (weeks). For a number of other univariate parameters I have used a mixed effects model with mesocosm within block as my random terms and treatment and time and their interaction as my main effects. (though I am not really interested in the effect of time) But in multivariate space I think the best I can do is: to test time and its interaction with treatment I have adonis(community~week*treatment, method=bray, perm=999,strata = enviro$mesocosm, data=enviro) and to test the main effect: library(BiodiversityR) nested.npmanova(community ~treatment + mesocosm, method=bray, data = enviro) Does this seem right? I acknowledge that I loose the ability to use block here but not much I can do right? I get this as the result: Total sum of squares for non-parametric manova: 26.8071635047485 Nested anova for mc nested within t.level Df SumsofSquares F N.Perm Pr(F) treatment31.4607 0.1727 100 1.00 mesocosm 12.8188 15.8910100 0.009901 ** Residuals 127 22.5277 0.1774 --- Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.�
Re: [R-sig-eco] Plot NMDS with size of the points related to abundance
Hi Barbara, You don't provide a reproducible example or even tell us what package/function you used to create your NMDS ordination, but you can extract the coordinates, and use them plus your cover values to create a bubble plot in several different ways, including symbols(), the pch argument to base plotting functions, and ggplot(). There's a nice tutorial for one method here: http://flowingdata.com/2010/11/23/how-to-make-bubble-charts/ but searching for bubble plot in R will get you many more options. Sarah On Tue, Mar 17, 2015 at 11:23 AM, Barbara Baraibar Padro bu...@psu.edu wrote: Hello list, I am analyzing species composition of weeds in 12 cover crop treatments and a fallow plot. I have been using nmds and got good results and no problems with it (although after some fighting!). My data is a matrix of biomass values sorted by species. Now I'd like to know which of my species are contributing with more biomass to the community in each treatment, that is, I'd like to create a graph such as the one that you get from the option plot (nmds_model, type=t, display=c(species)) but instead of getting just the names of the species, I'd like to see dots of different sizes that would refer to the abundance of each of the species, is that possible at all? I know you can do it with CANOCO but wanted to ask if there is a way to do it in R. I have searched the internet and found something that looks like what I want to do (enclosed to the mail) but haven't found the way to do it. I have already done an Indicator Species Analysis with the multipatt function. That gives me information about the species that are related to some treatments but here I'm just looking for the species with more and less biomass in each treatment. Thank you very much!! Barbara -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Plot NMDS with size of the points related to abundance
Assuming you're working with metaMDS from vegan, it's trivial to extract NMDS scores, add some variable and plot the data. The following code would be easy to translate into a generic function. library(vegan) data(dune) sol - metaMDS(dune) # add some variable that will correspond to size of points spc - as.data.frame(cbind(sol$species, mysize = runif(nrow(sol$species pts - as.data.frame(sol$points) library(ggplot2) ggplot(spc, aes(x = MDS1, y = MDS2)) + theme_bw() + geom_point(aes(size = mysize), pch = 1) + geom_point(data = pts, color = red) Cheers, Roman On Tue, Mar 17, 2015 at 4:23 PM, Barbara Baraibar Padro bu...@psu.edu wrote: Hello list, I am analyzing species composition of weeds in 12 cover crop treatments and a fallow plot. I have been using nmds and got good results and no problems with it (although after some fighting!). My data is a matrix of biomass values sorted by species. Now I'd like to know which of my species are contributing with more biomass to the community in each treatment, that is, I'd like to create a graph such as the one that you get from the option plot (nmds_model, type=t, display=c(species)) but instead of getting just the names of the species, I'd like to see dots of different sizes that would refer to the abundance of each of the species, is that possible at all? I know you can do it with CANOCO but wanted to ask if there is a way to do it in R. I have searched the internet and found something that looks like what I want to do (enclosed to the mail) but haven't found the way to do it. I have already done an Indicator Species Analysis with the multipatt function. That gives me information about the species that are related to some treatments but here I'm just looking for the species with more and less biomass in each treatment. Thank you very much!! Barbara -- Barbara Baraibar Post-doctoral scholar - Weed and Applied Plant Ecology Plant Sciences Department Penn State University University Park, Pennsylvania 16802 web-site:http://www.weedecologypsu.com ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- In God we trust, all others bring data. [[alternative HTML version deleted]] ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Plot NMDS with size of the points related to abundance
After clicking send I remembered that you might want to scale circle sizes according to their area, not radius (which is the default to draw). Then I went to see the link Sarah posted and it deals with this, too (great minds think alike? :) ). Cheers, Roman On Tue, Mar 17, 2015 at 4:39 PM, Roman Luštrik roman.lust...@gmail.com wrote: Assuming you're working with metaMDS from vegan, it's trivial to extract NMDS scores, add some variable and plot the data. The following code would be easy to translate into a generic function. library(vegan) data(dune) sol - metaMDS(dune) # add some variable that will correspond to size of points spc - as.data.frame(cbind(sol$species, mysize = runif(nrow(sol$species pts - as.data.frame(sol$points) library(ggplot2) ggplot(spc, aes(x = MDS1, y = MDS2)) + theme_bw() + geom_point(aes(size = mysize), pch = 1) + geom_point(data = pts, color = red) Cheers, Roman On Tue, Mar 17, 2015 at 4:23 PM, Barbara Baraibar Padro bu...@psu.edu wrote: Hello list, I am analyzing species composition of weeds in 12 cover crop treatments and a fallow plot. I have been using nmds and got good results and no problems with it (although after some fighting!). My data is a matrix of biomass values sorted by species. Now I'd like to know which of my species are contributing with more biomass to the community in each treatment, that is, I'd like to create a graph such as the one that you get from the option plot (nmds_model, type=t, display=c(species)) but instead of getting just the names of the species, I'd like to see dots of different sizes that would refer to the abundance of each of the species, is that possible at all? I know you can do it with CANOCO but wanted to ask if there is a way to do it in R. I have searched the internet and found something that looks like what I want to do (enclosed to the mail) but haven't found the way to do it. I have already done an Indicator Species Analysis with the multipatt function. That gives me information about the species that are related to some treatments but here I'm just looking for the species with more and less biomass in each treatment. Thank you very much!! Barbara -- Barbara Baraibar Post-doctoral scholar - Weed and Applied Plant Ecology Plant Sciences Department Penn State University University Park, Pennsylvania 16802 web-site:http://www.weedecologypsu.com ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- In God we trust, all others bring data. -- In God we trust, all others bring data. [[alternative HTML version deleted]] ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology