[adegenet-forum] Screeplot showing spatial and variance components of eigenvalues fails due to complex numbers
Jombart, Thibaut
t.jombart at imperial.ac.uk
Mon Nov 11 10:34:40 CET 2013
Hello,
the bug was not coming from adegenet, but from an oddity in 'eigen' which for some large symmetric matrices returns complex eigenvalues with imaginary parts equalling zero. Fixed now in the patch attached. On sourceforge now, and will integrate the next stable CRAN release.
Best
Thibaut
--
######################################
Dr Thibaut JOMBART
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - School of Public Health
St Mary’s Campus
Norfolk Place
London W2 1PG
United Kingdom
Tel. : 0044 (0)20 7594 3658
t.jombart at imperial.ac.uk
http://sites.google.com/site/thibautjombart/
http://adegenet.r-forge.r-project.org/
________________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Aaron.Adamack [Aaron.Adamack at canberra.edu.au]
Sent: 06 November 2013 12:21
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] Screeplot showing spatial and variance components of eigenvalues fails due to complex numbers
Hi, I’m trying to perform a sPCA and am getting an error when I attempt to make a screeplot showing the spatial and variance components of the eigenvalues. The error seems to be coming from the summary command that gets run within screeplot as I get the following error message:
> summary(possum.spca2)
Spatial principal component analysis
Call: spca(obj = nonapossum, cn = possum.graph, scannf = FALSE, nfposi = 2,
nfnega = 0)
Error in min(eigL) : invalid 'type' (complex) of argument
Looking at the step in summary just before it breaks, all (or nearly all) values of eigL are complex numbers (e.g. 1.025750e+00+0.000000e+00i).
Other than this, I am able to go through all of the steps in the examples provided in adegenet-spca.pdf, so I’m not sure if this is a sign of problems with my data set or if it could be something else? I am pointing to problems in my data set as there is quite a bit of missing data in my genotypes (~12.4%) and I have 1605 individuals.
The code I’m running is:
…
data organization steps to prepare my genind object dpossum
…
nonapossum<-na.replace(dpossum,met=0)
possum.graph<-chooseCN(nonapossum$other$xy,type=5,d1=0,d2=5000,plot=FALSE,res="listw")
possum.spca2<-spca(nonapossum,cn=possum.graph,scannf=FALSE,nfposi=2,nfnega=0)
screeplot(possum.spca2)
Any help in solving this would be greatly appreciated.
-Aaron
p.s. I think there may be a small typo on page 3 of the manual (adegenet-spca.pdf), I think the page reference for Numerical Ecology should be pp. 752-756 rather than pp. 572-576.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spca.R
Type: application/octet-stream
Size: 12866 bytes
Desc: spca.R
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20131111/bef9e77c/attachment.obj>
More information about the adegenet-forum
mailing list