Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Inconsistant results with adegenet::spca and adespatial::multispati #355

Open
arthurdegrandpre opened this issue Sep 13, 2023 · 0 comments

Comments

@arthurdegrandpre
Copy link

Hello,

I have been looking into solutions for spatial multivariate analysis and tried both spca and multispati, but their results are vastly different.
Isn't spca basically a wrapper to multispati? Maybe I'm mistaken in their use and/or call synthax.

Following is a reproducible example.
Merci!
Arthur

`
library(ade4)
library(adespatial)
library(adegraphics)
library(adegenet)
library(sp)
library(spdep)

data("mafragh")

analysis with multispati

mxy = as.matrix(mafragh$xy)
nb = chooseCN(coordinates(mxy), type = 1, plot.nb = FALSE)
lw = nb2listw(nb, style = 'W', zero.policy = TRUE)
pca = dudi.pca(mafragh$env, scale=T, center=T, scannf=F, nf=2)
ms = multispati(pca, lw, scannf=F)

ms_loadings = ms$c1[,1]^2

analysis with spca

spca = spca(mafragh$flo, xy=mafragh$xy, ask=F, type=1, scannf=F, scale=T, center=T, nfposi=2, nfnega=0)
spca_loadings = spca$c1[,1]^2

comparison

loadingplot(ms_loadings)
loadingplot(spca_loadings)
ms
spca
`

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant