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

Aaron.Adamack Aaron.Adamack at canberra.edu.au
Wed Nov 6 13:21:45 CET 2013


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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20131106/6119573c/attachment.html>


More information about the adegenet-forum mailing list