bhuss
bhuss

Reputation: 119

How to extract centroids coordinates in variables scales from OMI analysis

I am using OMI analysis from ade4 package, which works fine. i get species centroid coordinates (sp1, sp2, sp3, sp4) on the 2 axes (axis1, axis2), and the variables coordinates (Var1, Var2, Var3), also on the 2 axes.

Is there an automatic way to get centroid values of variables ( sp1 centroid is situated in a region of the PCA were Var1=.., var2=..., var3=...)?

here is an exemple, on 4 samples, with 4 species and 3 environmental variables:

env=cbind.data.frame(
Var1= c(2.3,5,6.9,2.4),
Var2=c(0.1,0.1,0.5,0.6),
Var3=c(1500,1200,1200,1200)
)
sp=cbind.data.frame(
Sp1= c(0 ,0,4,4),
Sp2=c(2,10,7,15),
Sp3=c(20,34,33,27),
Sp4=c(0,0,6,0)
)
pca.env=dudi.pca(env, scannf=FALSE)

nic=niche(pca.env, sp, scannf=FALSE)
plot(nic)

I would like to avoid solving the equations...

Thank you for any help!

Upvotes: 0

Views: 404

Answers (1)

mlegge
mlegge

Reputation: 6913

Just use the descriptions under Value in the help(niche) after loading the ade4 package. What you're looking for appears to be tab:

library("ade4")
env=cbind.data.frame(
  Var1= c(2.3,5,6.9,2.4),
  Var2=c(0.1,0.1,0.5,0.6),
  Var3=c(1500,1200,1200,1200)
)
sp=cbind.data.frame(
  Sp1= c(0 ,0,4,4),
  Sp2=c(2,10,7,15),
  Sp3=c(20,34,33,27),
  Sp4=c(0,0,6,0)
)
pca.env=dudi.pca(env, scannf=FALSE)
nic=niche(pca.env, sp, scannf=FALSE)

names(nic)
 [1] "tab"  "cw"   "lw"   "eig"  "rank" "nf"   "c1"   "li"   "co"   "l1"   "call" "ls"   "as"  
nic$tab
           Var1       Var2       Var3
Sp1  0.26020147 0.98787834 -0.5773503
Sp2 -0.03367313 0.34220622 -0.4415031
Sp3  0.16159881 0.04043946 -0.1721922
Sp4  1.43110811 0.76834982 -0.5773503

Upvotes: 1

Related Questions