Re: [R] Conditional CCA and Monte Carlo - Help!
MWilson mjw029 at bucknell.edu writes: Hi All, I am using canonical correspondence analysis to compare a community composition matrix to a matrix of sample spatial relationships and environmental variables. In order to parse out how much variance is explained purely by space (S/E) or the environment (E/S) I am using a conditional (partial) CCA. I want to test significance via Monte Carlo but I can not find a way to do this with a conditional CCA. I have been using vegan for the CCA and attempting to use ade4 to run a Monte Carlo. However, these two packages conflict when it comes to CCA. If I use vegan I can run a conditional CCA, and if I use ade4 I can do a Monte Carlo - but I can't figure out how to do a conditional CCA with ade4 OR a Monte Carlo with vegan. If anyone has experience with this I would be truly grateful for your help! I am fairly new to R, and I have quickly found myself in a place where Google-ing has no longer proven useful. Below are my scripts and error messages. -- View this message in context: http://r.789695.n4.nabble.com/Conditional-CCA-and-Monte-Carlo- Help-tp4662572.html Sent from the R help mailing list archive at Nabble.com. randtest() is an ade4 function that only works with ade4 result objects. That you found the hard way. In vegan we have permutest: see ?permutest.cca. Some other similar functions are described together with permutest.cca, but permutest() is similar to randtest. ade4::randtest.cca and vegan:::permutest.cca work similarly and are comparable with basic models, but there are following differences: 1) vegan uses ter Braak's pseudo-F statistic, whereas ade4 returns the proportion constrained/all eigenvalues. These are similar to a constant multiplier in non-conditional models and with direct or reduced permutation models in vegan, but differ otherwise. The ade4 alternative is not good for partial models (but that does not matter since ade4 has no partial models). The vegan:::permutest.cca function returns items num and den (numerator and denominator) that can be used to get the proportion of ade4. 2) vegan permutes response (community) data whereas ade4 permutes constraints (environmental data). This makes only difference in partial (conditional) models or with some non-default permutation strategies in vegan. However, because of this, ade4 and vegan results are not identical with the same random number seed (with little trickery this can be fixed, but that is hardly for beginners). Permutation of community data is needed in analysis of conditional (partial) models, and in some permutation strategies. 3) We do not call it Monte Carlo, but permutation. (Monte Carlo is too expensive for me -- I prefer Menton). That may explain why Google did not find it to you. In general, you should not expect methods functions (such as ade4::randtest.cca) to work across packages. In sometimes they do, but in those cases the package authors have taken special care to make their functions to work with alien objects. Not in this case. It neither makes sense for ade4::randtest be able to handle vegan object because randtest does not know what to do with contional (partial) models. Cheers, Jari Oksanen __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Conditional CCA and Monte Carlo - Help!
Thank you so much for your response! This clarifies the issue I was having. Cheers, Matt On Fri, Mar 29, 2013 at 2:43 AM, Jari Oksanen [via R] ml-node+s789695n4662809...@n4.nabble.com wrote: MWilson mjw029 at bucknell.edu writes: Hi All, I am using canonical correspondence analysis to compare a community composition matrix to a matrix of sample spatial relationships and environmental variables. In order to parse out how much variance is explained purely by space (S/E) or the environment (E/S) I am using a conditional (partial) CCA. I want to test significance via Monte Carlo but I can not find a way to do this with a conditional CCA. I have been using vegan for the CCA and attempting to use ade4 to run a Monte Carlo. However, these two packages conflict when it comes to CCA. If I use vegan I can run a conditional CCA, and if I use ade4 I can do a Monte Carlo - but I can't figure out how to do a conditional CCA with ade4 OR a Monte Carlo with vegan. If anyone has experience with this I would be truly grateful for your help! I am fairly new to R, and I have quickly found myself in a place where Google-ing has no longer proven useful. Below are my scripts and error messages. -- View this message in context: http://r.789695.n4.nabble.com/Conditional-CCA-and-Monte-Carlo- Help-tp4662572.html Sent from the R help mailing list archive at Nabble.com. randtest() is an ade4 function that only works with ade4 result objects. That you found the hard way. In vegan we have permutest: see ?permutest.cca. Some other similar functions are described together with permutest.cca, but permutest() is similar to randtest. ade4::randtest.cca and vegan:::permutest.cca work similarly and are comparable with basic models, but there are following differences: 1) vegan uses ter Braak's pseudo-F statistic, whereas ade4 returns the proportion constrained/all eigenvalues. These are similar to a constant multiplier in non-conditional models and with direct or reduced permutation models in vegan, but differ otherwise. The ade4 alternative is not good for partial models (but that does not matter since ade4 has no partial models). The vegan:::permutest.cca function returns items num and den (numerator and denominator) that can be used to get the proportion of ade4. 2) vegan permutes response (community) data whereas ade4 permutes constraints (environmental data). This makes only difference in partial (conditional) models or with some non-default permutation strategies in vegan. However, because of this, ade4 and vegan results are not identical with the same random number seed (with little trickery this can be fixed, but that is hardly for beginners). Permutation of community data is needed in analysis of conditional (partial) models, and in some permutation strategies. 3) We do not call it Monte Carlo, but permutation. (Monte Carlo is too expensive for me -- I prefer Menton). That may explain why Google did not find it to you. In general, you should not expect methods functions (such as ade4::randtest.cca) to work across packages. In sometimes they do, but in those cases the package authors have taken special care to make their functions to work with alien objects. Not in this case. It neither makes sense for ade4::randtest be able to handle vegan object because randtest does not know what to do with contional (partial) models. Cheers, Jari Oksanen __ [hidden email] http://user/SendEmail.jtp?type=nodenode=4662809i=0mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/Conditional-CCA-and-Monte-Carlo-Help-tp4662572p4662809.html To unsubscribe from Conditional CCA and Monte Carlo - Help!, click herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4662572code=bWp3MDI5QGJ1Y2tuZWxsLmVkdXw0NjYyNTcyfC0xMjYyOTcxMTM3 . NAMLhttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://r.789695.n4.nabble.com/Conditional-CCA-and-Monte-Carlo-Help-tp4662572p4662832.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
[R] Conditional CCA and Monte Carlo - Help!
Hi All, I am using canonical correspondence analysis to compare a community composition matrix to a matrix of sample spatial relationships and environmental variables. In order to parse out how much variance is explained purely by space (S/E) or the environment (E/S) I am using a conditional (partial) CCA. I want to test significance via Monte Carlo but I can not find a way to do this with a conditional CCA. I have been using vegan for the CCA and attempting to use ade4 to run a Monte Carlo. However, these two packages conflict when it comes to CCA. If I use vegan I can run a conditional CCA, and if I use ade4 I can do a Monte Carlo - but I can't figure out how to do a conditional CCA with ade4 OR a Monte Carlo with vegan. If anyone has experience with this I would be truly grateful for your help! I am fairly new to R, and I have quickly found myself in a place where Google-ing has no longer proven useful. Below are my scripts and error messages. Using Vegan: vare.cca - cca(InvertR.csv ~ Space1 + Space2... + Condition(Env1) + Condition(Env2)..., HabitatSpaceR.csv) randtest(vare.cca, nrepet = 1000) Error in randtest.cca(vare.cca, nrepet = 1000) : Object of class dudi expected Using ade4: vare.cca - cca(InvertR.csv ~ Space1 + Space2... + Condition(Env1) + Condition(Env2)..., HabitatSpaceR.csv) Error in cca(InvertR.csv ~ Space1 + Space2... + Condition(Env1) + Condition(Env2)... + : data.frame expected -- View this message in context: http://r.789695.n4.nabble.com/Conditional-CCA-and-Monte-Carlo-Help-tp4662572.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.