Running ANOVA in R on 4 different groups
1
0
Entering edit mode
4.1 years ago
janainamace ▴ 10

Hello everyone

I'm starting to use R to analyze proteomic data. I have 4 different groups and I would like to compare differentially expressed proteins. I would like to apply a One-way ANOVA followed by a Tukey post hoc test.

My data is organized as follows:

Group.......... Protein 1.......... Protein 2 ......Protein3025
A
A
B
B
C
C
D
D

data <- read.delim("~/ANOVA Test/data.txt")
data$Group <- factor(data$Group, levels=c("A","B","C", "D"))

data$Group
> [1] A A B B  C C  D D 
> Levels: A B C D
 myformula <- " ~ Group"

for (i in 2:ncol(data))
{
formula <- paste(colnames(data)[i], myformula, sep="")
p <- summary(aov(as.formula(formula), data=data))[[1]][["Pr(>F)"]][1]
print(paste(formula, ": p=", p, sep=""))
}


>[1] "Q9C075 ~ Group: p=0.000525021327472293"
>[1] "Q6A162 ~ Group: p=0.000525021327472293"
>[1] "O76009 ~ Group: p=0.000525021327472293"
>[1] "P0DN37 ~ Group: p=0.000389600632838321"
>[1] "P0DN26 ~ Group: p=0.000389600632838321"
>[1] "F5H284 ~ Group: p=0.000389600632838321"

....

So far, I have this result, but I would like to know which proteins are regulated in all comparisons, that is, AB, AC, AD, BC, DC. Can someone help me? Is this approach correct?

Thanks in advance

R • 806 views
ADD COMMENT
1
Entering edit mode
4.1 years ago

You will want to use Dunn's post-hoc test, which will test the pairwise comparisons between all possible groups as part of non-parametric ANOVA (Kruskal-Wallis test). The dunntest() function is part of the FSA package (CRAN). I trust that you will be able to look at the documentation and devise your own code from there.

Kevin

ADD COMMENT
1
Entering edit mode

Thank you so much Kevin! You helped me a lot.

ADD REPLY
1
Entering edit mode

Sure thing my friend / Valeu

ADD REPLY

Login before adding your answer.

Traffic: 2426 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6