[R-sig-eco] order of explanatory variables in vegan CCA

Jari Oksanen jari.oksanen at oulu.fi
Sun Dec 25 08:10:01 CET 2011


Matt & Gav,

I've seen this before, and I think this can be difficult to handle in vegan: The problem is not in vegan, and it is not in R, but it is in LAPACK library. When I last had this problem, I hacked the vegan code and ran svd() within cca/rda with option LINPACK = TRUE. This helped me to get around the problem. 

I think that LAPACK DGESDD error code 1 tries to tell in a cryptic way that the convergence failed. It is surprising to hear that reordering data helped here. Looks like DGESDD failed in pivoting the data when it should have done so. Are the variables very differently scaled? Vegan does not scale explanatory variables in cca/rda/capscale, but you could try if manual scaling helps here. If scaling helps, then we could re-consider scaling of constraints within cca/rda as a safe option. However, that would break at least predict(..., newdata=) and probably something else and cannot be done light-heartedly. 

Cheers, Jari Oksanen

On 23/12/2011, at 21:49 PM, Gavin Simpson wrote:

> Hi Matt,
> 
> Would you mind sending me the data *off list* so I can see if I can
> reproduce. The failure is within a basic part of the R stack (Lapack
> matrix algebra code supplied with R) so points to something with the
> data and perhaps your matrix (or a subsidiary matrix computed during the
> CCA fitting) is close to being degenerate in some way and that when
> re-ordered it is slightly less degenerate. [I'm using the word
> degenerate loosely here).
> 
> I promise to delete the data once I've reproduced the problem.
> 
> G
> 
> On Wed, 2011-12-21 at 14:22 -0800, Gregory, Matthew wrote:
>> Hi all,
>> 
>> We run vegan CCA as part of an automated process.  Our typical use case is to read in species and environment matrices (from CSV files) and subset the environmental matrix with a vector of field names ('vars'), e.g. 
>> 
>>  spp <- read.csv(spp_file, row.names = id_field)
>>  env <- read.csv(env_file, row.names = id_field)
>>  env <- env[,vars]
>>  cca_obj <- cca(spp, env)
>> 
>> Today, for the first time, we received the following error:
>> 
>>  Error in La.svd(x, nu, nv) : error code 1 from Lapack routine 'dgesdd'
>> 
>> which from googling implies that the SVD did not converge.  If I reorder the 'vars' list and rerun, I can have it run to completion.  I am completely naïve with ordination modeling, but is there any reason why the order of environmental variables would matter to CCA?  I would have thought this wouldn't matter.
>> 
>> Thanks for any pointers.
>> 
>> matt
>> 
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at 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 at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

-- 
Jari Oksanen, Dept Biology, Univ Oulu, 90014 Finland
jari.oksanen at oulu.fi, Ph. +358 400 408593, http://cc.oulu.fi/~jarioksa



More information about the R-sig-ecology mailing list