[R-sig-eco] PCA for composition data followed by RLQ

Simone Blomberg @@b|omberg1 @end|ng |rom uq@edu@@u
Tue Feb 22 04:47:45 CET 2022


I can recommend the book, "Analyzing Compositional Data with R." by van 
den Boogaart and Tolosana-Delgado. It should help you with any code and 
formulas for transformations etc. They have developed the Compositions 
package for R.

Cheers,

Simone Blomberg.

On 22/2/22 13:32, Diogo B. Provete wrote:
> Hi Terri,
> thanks for the feedback. Yes, I meant exactly the transformations proposed
> by Aitchison. The point is my diet data (*R*) is expressed as the
> percentage of a given item found in bat faeces. So I have 5 variables
> (pollen, insects, fish etc) with varying percentages whose rows sum to 100.
> As for the species composition matrix (*L*), yes, certainly the Hellinger
> transformation can be applied in this case, but I was more worried about
> how to treat the diet data before entering them in the RLQ itself. So, how
> can I calculate the log-ratios ? There's this function in  rgr::clr, but
> I'm not entirely sure it's what I need.
>
> Best,
> Diogo
>
> Em seg., 21 de fev. de 2022 às 23:11, Terri Lacourse <tlacours using uvic.ca>
> escreveu:
>
>> Dear Diogo,
>>
>> I don’t see a way to run a “compositional PCA” in ade4. I presume you mean
>> log-ratios as proposed by Aitchison? Could you determine the log-ratios
>> first and then send that to the dudi matrix?
>>
>> Perhaps you could use Hellinger transformation instead for your
>> compositional data. That is what I do, and then I set the RLQ environment
>> in this way:
>>
>> data1_L <- dudi.coa(data1, scannf=F, nf=2) # these are
>> Hellinger-transformed compositional data like your diet data
>> data2_R <- dudi.pca(data2, scannf=F, nf=2, row.w=data1_L$lw)
>> data3_Q <- dudi.pca(data3, scannf=F, nf=2, row.w=data1_L$cw)
>> rlq.output <- rlq(data2_R, data1_L, data3_Q, scannf=F, nf=2)
>>
>> Best wishes,
>> -Terri
>>
>> ~~~~~~~~~~~~~~~~~~~
>> Terri Lacourse
>> Associate Professor
>> Department of Biology
>> University of Victoria
>> Victoria, BC
>> Canada V8W 2Y2
>>
>> tlacours using uvic.ca
>> ~~~~~~~~~~~~~~~~~~~
>>
>>
>>
>>> On Feb 21, 2022, at 12:14 PM, Diogo B. Provete <dbprovete using gmail.com>
>> wrote:
>>> Dear members,
>>> I'm trying to run an RLQ analysis to test for a covariation between skull
>>> shape (set of eigenvectors) and diet composition for a set of bat
>> species.
>>> The point is, the data for diet is expressed as percentage, with rows
>>> (species) summing to 100. Therefore, it's better treated as compositional
>>> data.
>>>
>>> I have already run a compositional PCA in the R package compositions,
>> which
>>> returns an object of the class princomp. However, ade4::rlq only accepts
>>> dudi matrices. I don't know how to convert a princomp to a dudi object or
>>> perhaps run a compositional PCA in ade4. as.dudi seems not to be called
>>> directly by the user.
>>>
>>> Does anyone have any clue on how to do this?
>>>
>>> Thank you in advance,
>>> Diogo
>>>
>>> --
>>>
>>> Diogo B. Provete, PhD
>>>
>>> Assistant Professor
>>>
>>> Biodiversity Synthesis lab <http://diogoprovete.weebly.com/>
>>>
>>> Biosciences Institute | Federal University of Mato Grosso do Sul | Brazil
>>>
>>>
>>> Skype: diogoprovete
>>>
>>>
>>> Director of Graduate studies in Animal Biology
>>> <https://ppgbioanimal.ufms.br/>
>>> __
>>> Biodiversity & Conservation Section Editor at PeerJ
>>> Open Access Journals
>>> peerj.com/diogoprovete  <https://peerj.com/diogoprovete/>
>>>
>>> Associate Editor: Austral Ecology
>>> <
>> https://onlinelibrary.wiley.com/page/journal/14429993/homepage/editorialboard.html
>>> | Amphibia-Reptilia
>>> <https://brill.com/view/journals/amre/amre-overview.xml> | BMC Ecology
>> and
>>> Evolution | Ecosphere
>>> <
>> https://esajournals.onlinelibrary.wiley.com/hub/journal/21508925/editorial-board/editorial-board
>>> | Ecology and Evolution | Frontiers in Ecology and the Environment |
>>> Journal of Biogeography | Journal of Herpetology
>>> <https://journalofherpetology.com/>
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-ecology mailing list
>>> R-sig-ecology using r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

-- 
Simone Blomberg, BSc (Hons), PhD, MAppStat.
Senior Lecturer and Consultant Statistician
School of Biological Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
email: S.Blomberg1_at_uq.edu.au
Twitter: @simoneb66
UQ ALLY Supporting the diversity of sexuality and gender at UQ.

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

If you can’t stand algebra, stay out of evolutionary biology. - J. M. Smith.



More information about the R-sig-ecology mailing list