[R-sig-eco] Rotations for PCoA?

Jari Oksanen jari.oksanen at oulu.fi
Tue Oct 20 22:40:04 CEST 2009




On 20/10/09 13:19 PM, "Etienne Laliberté" <etiennelaliberte at gmail.com>
wrote:

>> Date: Mon, 19 Oct 2009 13:44:57 +0200
>> From: Jan Hanspach <jan.hanspach at ufz.de>
>> Subject: [R-sig-eco] Rotations for PCoA?
>> To: r-sig-ecology at r-project.org
>> Message-ID: <4ADC5139.9000707 at ufz.de>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>> 
>> 
>> 
>> Now, I want to know if  it is possible to get rotations for my traits,
>> like it is calculated for a PCA? So that I can plot my traits within the
>> ordinations space (or give the values in a table).
>> Thanks!
>> Jan
> 
> Pierre Legendre recently emailed me one function which does exactly
> that. I haven't found it on his website so I assume it's not
> "official" yet. In any case, I'm sure he wouldn't mind me sharing it
> and it can certainly give you some good ideas on how to represent the
> original variables in a PCoA biplot. Here's the code. Enjoy.
> 
> 
Howdy Folks,

Actually, it is "trivial" to have rotation scores for continuous variables:
it is nothing but matrix multiplication. The problem here is that the
original analysis used Gower distance for mixed metrics, and we should map
the factor variables onto continuous variables in the same way as the Gower
distance does. After that it is "easy" to find the "rotation" scores (but
see below on metrics). While this can be done, this probably is not wanted
since the interpretation of "rotation" for factors is non-intuitive, to put
it mildly. Gower distance handles factors in a special way, and they are not
the simple factor contrasts you get in standard R functions. How they are
actually handled can be seen in the Fortran code for daisy or in Gower's
paper. An extra complication is that Gower distance uses Manhattan metric.
Therefore it is not possible to just transform data matrix into a form that
would give the rotation scores in Euclidean PCoA.

The standard way (that is not used in Gower distance) to transform factors
into continuous data is to use

 mm <- model.matrix(~ ., mydatawithfactors)

Which gives you a model matrix where factors are broken into continuous
contrast variables. You can get "rotation", biplot scores or what ever you
call for these contrasts, but that is only the beginning of the problems --
what are you going to do with those scores?

Perhaps you can try vegan function envfit which finds the "rotation" scores
for continuous variables and class centroids for factor variables. They are
not the same as the strict rotation scores for factors in Gower metric (but
should be the same as the Legendre scores for continuous variables), but may
be more intuitive. 

Cheers, jari oksanen



More information about the R-sig-ecology mailing list