[R-sig-eco] partial ordination
Hello all, I'm interested in applying an ordination method (e.g. PCA or NMDS) to a species matrix. However, I want to remove the potential effect of the environment, which I'm not interested in modelling, from the ordination (i.e. partialling out the environmental effect). I've thought in the following approach (with the vegan package): # spe: species matrix # env: environment matrix partial.pca-rda(spe~1+Condition(env)) plot(partial.pca) Is this a reasonable approach? Some feedback would be great. Thanks, Duarte ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[R-sig-eco] NA in species scores using capscale in vegan
Hello all, I am doing a CAP (or dbRDA) in vegan, using the function capscale, where the response is a dissimilarity matrix (Sorensen's distance index) and the explanatory matrix consists of 19 variables. The code runs apparently fine, but the species scores appear as NA (site scores are properly given). Does anyone knows what might be the problem? Thanks, Duarte [[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] NA in species scores using capscale in vegan
Hi Jari, No, I completely missed that argument. It now provides the species scores. Thanks a lot, Jari. Cheers, Duarte On Thu, Nov 7, 2013 at 11:11 AM, Jari Oksanen jari.oksa...@oulu.fi wrote: On 07/11/2013, at 12:05 PM, Duarte Viana wrote: Hello all, I am doing a CAP (or dbRDA) in vegan, using the function capscale, where the response is a dissimilarity matrix (Sorensen's distance index) and the explanatory matrix consists of 19 variables. The code runs apparently fine, but the species scores appear as NA (site scores are properly given). Does anyone knows what might be the problem? Duarte, Did you supply species data? Species scores cannot be estimated without information on species. If your response is a dissimilarity, there is no information about the original species. You can supply the original community data (which has the information on species) as argument 'comm' in capscale(). Cheers, Jari Oksanen [[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] Error in La.svd(x, nu, nv) : error code 1 from Lapack routine 'dgesdd'
Hi Jesse and Gavin, I remember that post and I think that turning the argument LINPACK of the function svd on solved the problem. I did so by: 1. pasting the code of function svd (that can be found in the source code of the base package) on the console 2. changing the argument LINPACK=FALSE to LINPACK=TRUE 3. re-assigning the function to the base package with the code: assignInNamespace(svd, svd, base) However I do not know whether this is the best solution. Perhaps Gavin can find out what the real problem is. I would appreciate if you both could keep me informed about any progress. Kind regards, Duarte On Wed, Jan 16, 2013 at 11:35 AM, Gavin Simpson gavin.simp...@ucl.ac.uk wrote: Hi Jesse, Can you send me the data *and* *exact* code you used so I can look into this further? I promise to delete the data once I have gotten to the bottom of the problem. If you can, please do so *off list*. If you can't then it might help to scale the numbers a bit as range of 5 orders of magnitude may be causing some numerical issues with your data. Note this has nothing to do with vegan; cocorresp is a separate package. Re the last question; it is possible and IIRC there is some Matlab code to do some of this in the supplementary materials for the ter braak schaffers paper. I got some way to implementing this in R but finishing it off went to the back burner and I never get back to it since. All the best, Gavin On Tue, 2013-01-15 at 19:09 -0800, Jesse_B wrote: Question 1 - It's been a while, so I don't know who will see this, but I am having the same issue. I have count data from two species matrices (fish and inverts) and I am trying to run CoCA through cocorresp. Symmetric CoCA works fine, and is the main thing that I need, but I would like to be able to switch predictor-response species matrices in a predictive CoCA, to see if there are differing patterns of top-down/bottom-up concordance. I have substantial skew in the data, so I have log+1 transformed both sets of data. I can run crossval on the raw data (not transformed, 99 samples [33 sites over 3 seasons], 72 fish species, 226 invert species, individual numbers are in the same ranges, between 0 and 10K for both fish and inverts), but on the transformed data, I get the Error in La.svd(x, nu, nv) : error code 1 from Lapack routine 'dgesdd' message consistently on the 5th site. I am comfortable _using_ R and the vegan package in particular, but I am not experienced in more deep coding, so I don't have a handle on how to turn LINPACK on. R version 2.15.2, vegan 2.0-4, cocorresp 0.2-0 crossval(fishlog,invertlog) LOO - Site: 1 - Complete LOO - Site: 2 - Complete LOO - Site: 3 - Complete LOO - Site: 4 - Complete LOO - Site: 5Error in La.svd(x, nu, nv) : error code 1 from Lapack routine 'dgesdd' Question 2 - Is it possible to run crossval on matricies for a CCA? to make it a PLS-CCA (as in Schaffers et al. 2008) or am I misunderstanding the process that they used? Thanks in advance! Jesse -- View this message in context: http://r-sig-ecology.471788.n2.nabble.com/Error-in-La-svd-x-nu-nv-error-code-1-from-Lapack-routine-dgesdd-tp7556369p7577802.html Sent from the r-sig-ecology mailing list archive at Nabble.com. ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[R-sig-eco] error message with function rda of package vegan
Hi, Thanks Jari for your help. I forgot to say that I am working in a Mac (OS X, 10.6.8) and was using the vegan version 2.0-2 of 2011. I've just updated vegan to version 2.0-3 and now it runs fine (with the same results as Jari). I should have checked for a newer version before asking for help... Anyway it looked strange, because it happened with these specific data matrices. I tried to substitute either the response or explanatory matrix with others (in the older version) and it always ran fine. Well, somehow the problem is gone. Thank you all for your help and patience. Cheers, Duarte On Tue, Jun 12, 2012 at 10:34 AM, Jari Oksanen jari.oksa...@oulu.fi wrote: Howdy Folks, I received the two data files from Duarte Viana, but I can't reproduce the problem: it runs smoothly in my computer. resp-read.table(resp.txt,header=F,sep=\t) explan-read.table(explan.txt,header=F,sep=\t) library(vegan) Loading required package: permute This is vegan 2.1-16 rda(resp, explan) Call: rda(X = resp, Y = explan) Inertia Proportion Rank Total 0.7156 1. Constrained 0.1654 0.2312 4 Unconstrained 0.5502 0.7688 83 Inertia is variance Eigenvalues for constrained axes: RDA1 RDA2 RDA3 RDA4 0.08284 0.03875 0.02849 0.01534 Eigenvalues for unconstrained axes: PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 0.04263 0.03916 0.03031 0.02678 0.02459 0.02294 0.02092 0.01955 (Showed only 8 of all 83 unconstrained eigenvalues) The problem seems not be reproducible in my PC (I can try Mac later). About the error message you got: it seems to occur when the 'rank' of your solution is non-numeric (text). The 'rank' is found from the QR decomposition, and non-numeric 'rank' means that QR decomposition failed and returned something else than a real 'rank' (even NULL rank should give a different error message, and zero rank should be handled). I could not reproduce the problem so I have no idea how this would happen. I need more details to reproduce the problem. The rda.default function (where this error seems to emanate) was last changed in October 2011, but that change should not influence this behaviour (but on the other hand, I cannot see how this behaviour arises). More directly related changes are from May 2011 which should be in the release 1.17-11 of June 2011. Are you are using a recent version of vegan? Have you checked your files after reading them? Cheers, Jari Oksanen Cheers, Jari Oksanen From: r-sig-ecology-boun...@r-project.org [r-sig-ecology-boun...@r-project.org] on behalf of Duarte Viana [viana.s...@gmail.com] Sent: 11 June 2012 21:47 To: Sarah Goslee Cc: r-sig-ecology@r-project.org Subject: [R-sig-eco] error message with function rda of package vegan Hi, Thank you for your reply. It's not easy to give you a reproducible example, because this is a very specific case (something in my data , I believe). The only way is to send the data and try yourself. If someone is willing to do that, I would be grateful. I can send the response matrix and the explanatory matrix, and all one has to do is load library vegan, load the data, and run the rda function: library(vegan) resp-read.table(resp.txt, head=F, sep=\t) expl-read.table(expl.txt, head=F, sep=\t) myrda-rda(resp, expl) Thanks, Duarte On Mon, Jun 11, 2012 at 6:42 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Hi, On Mon, Jun 11, 2012 at 12:35 PM, Duarte Viana viana.s...@gmail.com wrote: Hello all, Apologies for cross postings. I am running the function rda of the vegan library, like I did many times without having troubles, and I get the following error message: Error in if (rank) { : argument is not interpretable as logical. I am just testing a response matrix against a single explanatory matrix, which is the result of a model matrix with 4 dummy variables (coding for a factor of 5 levels). myrda-rda(resp, expl) When I, for instance, change the response matrix, it goes well. Does anyone know what might be happening? Not without a reproducible example, I'm afraid. Sarah -- 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 ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[R-sig-eco] error message with function rda of package vegan
Hello all, Apologies for cross postings. I am running the function rda of the vegan library, like I did many times without having troubles, and I get the following error message: Error in if (rank) { : argument is not interpretable as logical. I am just testing a response matrix against a single explanatory matrix, which is the result of a model matrix with 4 dummy variables (coding for a factor of 5 levels). myrda-rda(resp, expl) When I, for instance, change the response matrix, it goes well. Does anyone know what might be happening? Thanks, Duarte ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[R-sig-eco] error message with function rda of package vegan
Hi, Thank you for your reply. It's not easy to give you a reproducible example, because this is a very specific case (something in my data , I believe). The only way is to send the data and try yourself. If someone is willing to do that, I would be grateful. I can send the response matrix and the explanatory matrix, and all one has to do is load library vegan, load the data, and run the rda function: library(vegan) resp-read.table(resp.txt, head=F, sep=\t) expl-read.table(expl.txt, head=F, sep=\t) myrda-rda(resp, expl) Thanks, Duarte On Mon, Jun 11, 2012 at 6:42 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Hi, On Mon, Jun 11, 2012 at 12:35 PM, Duarte Viana viana.s...@gmail.com wrote: Hello all, Apologies for cross postings. I am running the function rda of the vegan library, like I did many times without having troubles, and I get the following error message: Error in if (rank) { : argument is not interpretable as logical. I am just testing a response matrix against a single explanatory matrix, which is the result of a model matrix with 4 dummy variables (coding for a factor of 5 levels). myrda-rda(resp, expl) When I, for instance, change the response matrix, it goes well. Does anyone know what might be happening? Not without a reproducible example, I'm afraid. Sarah -- 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] Error in La.svd(x, nu, nv) : error code 1 from Lapack routine 'dgesdd'
Thanks Jari for your help. Changing the option of the svd function to LIMPACK=TRUE indeed resolved the problem. I just copy-paste the function svd to the console (maintaining the name svd), changed LIMPACK=FALSE to LIMPACK=TRUE, and then assigned the function to the namespace base: assignInNamespace(svd, svd, base) It worked! Thanks again, Duarte On Mon, May 14, 2012 at 3:25 PM, Jari Oksanen jari.oksa...@oulu.fi wrote: We have had similar reports from many cases (for instance, from cca/rda functions in vegan). The problem is difficult to track. Cases that we have seen so far probably are problems in LAPACK library, and the kind of LAPACK used can depend on the version of R, version of LAPACK, compilers used, operating system and its version, computer hardware, phase of moon etc. Error code 1 from dgesdd should be a convergence problem. With presence/absence data there may not be much you can with the data. With quantitative data, rescaling of data has been helpful, but hardly with p/a (Hellinger transformation will also change data properties and is not data neutral: division of subtraction with some constant is data neutral and helps sometimes, but hardly with p/a data). The svd() function in R provides a R1.7.0 compatibility option LINPACK = TRUE which has helped sometimes. We haven't added that as an option for svd() in cocorresp or vegan as it is documented only as a compatibility option for old R. However, you can try editing the files to use LINPACK = TRUE to see if the problem vanishes (but NAMESPACE add some pain in using edited files). HTH, Jari Oksanen From: r-sig-ecology-boun...@r-project.org [r-sig-ecology-boun...@r-project.org] on behalf of Duarte Viana [viana.s...@gmail.com] Sent: 14 May 2012 16:09 To: r-sig-ecology@r-project.org Subject: [R-sig-eco] Error in La.svd(x, nu, nv) : error code 1 from Lapack routine 'dgesdd' Hello all, When I perform a cross validation with the function crossval of the package cocorresp (for a co-correspondence analysis), I get the following error: Error in La.svd(x, nu, nv) : error code 1 from Lapack routine 'dgesdd' I think the problem is not in the function, as other people has had the same error for other types of model (see, for example, http://comments.gmane.org/gmane.comp.lang.r.ecology/2608). From this and other posts, I suppose it is a convergence problem. I am working with presence-absence species matrices, and the problem persists even if I transform the matrices with Hellinger transformation (although not at the same site). Does anyone know how to solve, or go around, this problem? Any advice would be most welcome. Thanks, Duarte ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[R-sig-eco] Co-correspondence analysis
Dear all, I want relate two matrices of species presence-absence data, preferably in a predictive manner. Is it reasonable to do it by co-correspondence analysis using the coca function in the cocorresp package? Some papers seem to use presence-absence data, but the help document for this function only refers to abundance data. Any insights in this would be greatly appreciated. Duarte ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology