Open LeandroD94 opened 1 year ago
Dear Greg Gloor and Leandro, I have a very similar situation. I have 7 groups and I want to make specific comparisons among them, I do not have a particular reference group because it is not applicable in my case. Would there be a way of specifying the contrasts (comparisons) of interest? Thank you very much in advance. Best regards, Pilar
Hi Leandro and Pilar
In order to do this, I will need to integrate the multcomp function into the aldex.glm back end (see https://stackoverflow.com/questions/51702221/glm-in-r-give-all-comparisons) for how to do this.
This will be a fairly major re-write
Hi everybody, same issue with me, need to assess pairwise a multi-group dataset. The multcomp function proposed by ggloor would fit perfectly for my data and in general I think that the aldex approach would greatly benefit from it in the scope of "competing" for accuracy with other tools currently used (and abused) Best, Matteo
Good morning everyone, It would be very useful to me to perform pairwise comparisons between three (or more) groups. I hope a way is found soon, Sara
Hi Leandro and Pilar
In order to do this, I will need to integrate the multcomp function into the aldex.glm back end (see https://stackoverflow.com/questions/51702221/glm-in-r-give-all-comparisons) for how to do this.
This will be a fairly major re-write
This would be super useful!
Dear ggloor, As requested, I continue here the topic from https://github.com/ggloor/ALDEx2_dev/issues/33 opened by the user carburator. I rewrite my question below, for clarity of the other users.
My aim is to use ALDEx2 to explore the pairwise differences between three groups (A vs B, B vs C, A vs C). To do so, I want to use the glm module as suggested in the vignette but I don't understand how to get EVERY pairwise comparison. Then, I post down there a short R script just to create a dataset that is similar to the one of my interest (aside from the abundances).
R Script
library(ALDEx2) sample_number<-30 obs_number<-50
Just an example dataset
feature_table<-NULL for(x in 1:obs_number){ new_obs_Abundance<-c( rnbinom(n=sample_number/3, size=2000, mu = 900), rnbinom(n=sample_number/3, size=2000, mu= 1800), rnbinom(n=sample_number/3, size=2000, mu=50)) new_obs_Abundance[sample(sample_number, size = sample_number/1.5)] <- 0 # a false zero inflation feature_table<-rbind(feature_table, new_obs_Abundance) } row.names(featuretable)<-paste0("Observation",1:obs_number) colnames(featuretable)<-paste0(rep("Sample"),1:sample_number)
building the sample data
Target_groups<-factor(c(rep("A",sample_number/3), rep("B",sample_number/3), rep("C",sample_number/3) ), level=c("A","B","C") ) Confounding_factor<-c(rep("S",sample_number/2),rep("R",sample_number/2))
using ALDEx2 glm module
mm <- model.matrix(~ Confounding_factor + Target_groups) # name of the sample data for last aldx <- aldex.clr(feature_table, mm, mc.samples=128, denom="all", verbose=T ) aldx2 <- glm.test <- aldex.glm(aldx, mm) aldx3 <- aldex.glm.effect(aldx, CI = F) aldx_final <- data.frame(aldx2,aldx3) head(aldx_final)
three groups results
p_val<-aldx_final$Target_groupsB.pval.holm # I know I should check the CI, but this approach allows to simplify my question Results_A_vs_B<-aldx_final[p_val<0.05] p_val<-aldx_final$Target_groupsC.pval.holm Results_A_vs_C<-aldx_final[p_val<0.05]
Then...
Assuming that what I wrote until now is correct, at this point I just want to get ALSO the results of the last comparison (B vs C) but I only have the ones against the reference level (A). How to do this? Should I to re-level the factor changing the reference level or can I use the estimates of the levels B and C? I have already tried to remove the intercept (0 + ) but I did not know how to continue.
Thank you so much for your time and support, Leandro