What if you run
clr_data= compositions::clr(data+pseudocount) #add pseducount if data
contains a lot of zeroes. However function performs clr-transformation on
non-zeroes (what is called robust clr).
aitchison_distance = dist(clr_data, method=?euclidean?)
pca_data = dudi.pca(data.frame(aitchison_distance))
Cheers
Johannes
On 22 Feb 2022, at 05:11, Terri Lacourse <tlacours at uvic.ca> wrote:
?Hi Diogo,
I think you can also apply the Hellinger transformation to your table R
data, and then use dudi.pca, no?
But, yes, the rgr::clr function is what you are after. It will give you
the centered log-ratio transformation proposed by Aitchison. Or you could
try rgr::ilr. But neither are suitable if your data have many zeros.
On Feb 21, 2022, at 7:32 PM, Diogo B. Provete <dbprovete at gmail.com>
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 at uvic.ca
<mailto:tlacours at 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 at uvic.ca <mailto:tlacours at uvic.ca>
~~~~~~~~~~~~~~~~~~~
On Feb 21, 2022, at 12:14 PM, Diogo B. Provete <dbprovete at gmail.com
<mailto:dbprovete at gmail.com>> wrote:
Dear members,
I'm trying to run an RLQ analysis to test for a covariation between
shape (set of eigenvectors) and diet composition for a set of bat
The point is, the data for diet is expressed as percentage, with rows
(species) summing to 100. Therefore, it's better treated as
data.
I have already run a compositional PCA in the R package compositions,
returns an object of the class princomp. However, ade4::rlq only
dudi matrices. I don't know how to convert a princomp to a dudi object
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 |
Associate Editor: Austral Ecology
<
[[alternative HTML version deleted]]