[adegenet-forum] Screeplot showing spatial and variance components of eigenvalues fails due to complex numbers

Jombart, Thibaut t.jombart at imperial.ac.uk
Wed Nov 6 17:13:38 CET 2013


Hello there, 

thanks for reporting the error. I confess it is beyond me how one can get complex eigenvalues in sPCA. As this is the first time it happens, there may be something quirky about this particular dataset.

I would need a reproducible example to possibly try and understand what is going on. Thanks for the typo, fixed on the devel now.

Cheers
Thibaut


________________________________________
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.


More information about the adegenet-forum mailing list