[R-sig-Geo] randtest.enfa {adehabitat} -- erratum in calculating the tolerance

Clément Calenge clement.calenge at gmail.com
Wed Jun 9 11:16:09 CEST 2010


On 06/09/2010 09:05 AM, Clément Calenge wrote:
>
>>
>> sum(dudi.pca(kasc2df(map), row.w = dataenfa1$pr/sum(dataenfa1$pr),
>> scan=FALSE)$eig)
>>
>> which gives you 5 only. The weights should sum to 1 (i.e. they are
>> proportions). But then, how would you interpret this? This is the same
>> as for the "global specialization".
>
> Yes, but be careful: kasc2df returns a list with one component "tab" 
> (the component of interest) and one component "index" (the component 
> allowing to rebuild the original kasc), so that the correct code is:
>
> sum(dudi.pca(kasc2df(map)$tab, row.w = dataenfa1$pr/sum(dataenfa1$pr), 
> scan=FALSE)$eig)

I was a bit too hasty for this reply. Actually the code is incorrect. 
Consider the following code:

pc <- dudi.pca(kasc2df(map)$tab, row.w = dataenfa1$pr/sum(dataenfa1$pr))

This code performs a *centered and scaled* PCA of the environmental 
variables: this analysis first centers and scales the table containing 
the value of the environmental variables. Therefore, for each variable 
of pc$tab, the mean *weighted by the utilization weights* is equal to 
zero and the variance *weighted by the utilization weights* is equal to 
1. Therefore, the sum of the eigenvalues of the PCA on this transformed 
table is equal to the number of environmental variables. This code is 
incorrect (thanks Mathieu for noting the inconsistency). First, to 
calculate the global tolerance, you would need to calculate:

pc <- dudi.pca(kasc2df(map)$tab, scan=FALSE)

This preliminary analysis is performed just to center/scale the 
variables with uniform weighting. This allows to compare the different 
variables in pc$tab (they all have the same average and the same scale). 
*Then*, calculate the weighted and *unscaled* PCA of the table pc$tab:

sum(dudi.pca(pc$tab, scale=FALSE, row.w = 
dataenfa1$pr/sum(dataenfa1$pr), scan=FALSE)$eig)

This gives the tolerance of the species on the area,
Sorry for the confusion,
HTH,

Clément Calenge

-- 
Clément CALENGE
Cellule d'appui à l'analyse de données
Office national de la chasse et de la faune sauvage
Saint Benoist - 78610 Auffargis
tel. (33) 01.30.46.54.14



More information about the R-sig-Geo mailing list