can anyone help me to understand this. I have data to compare among 3 experiments with 2 treatments each.I want to compare a measured variable between the 2 conditions for each experiment. I first ran an ANOVA (significant) then a post hoc tukey test. One of comparison is not significant although the values between the conditions are different (please see the boxplot, exp1). I pasted a part of the post hoc output with the result confusing me Exp1:U-Exp1:B where pvalue>0.05.
can anyone help me understand this?
test <- structure(list(exp = c("Exp1", "Exp1", "Exp1", "Exp1", "Exp1",
"Exp1", "Exp2", "Exp2", "Exp2", "Exp2", "Exp2", "Exp2", "Exp2",
"Exp2", "Exp3", "Exp3", "Exp3", "Exp3", "Exp3"), cond = c("B",
"B", "B", "U", "U", "U", "B", "B", "B", "B", "U", "U", "U", "U",
"B", "B", "B", "U", "U"), variable = c(0.00838203, 0.0103495,
0.00757493, 0.02157368, 0.0132083, 0.01336677, 0.03054078, 0.01570897,
0.028895, 0.02730669, 0.05822746, 0.05476223, 0.05476223, 0.05814691,
0.00358898, 0.00721144, 0.01070452, 0.00348329, 0.00613196)), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -19L))
ggboxplot(test , x="exp", y='variable',fill='cond')+facet_wrap(.~exp,scales = 'free')
#run an anova
# Compute the analysis of variance
anova <- aov(variable ~ exp*cond, data = test )
# Summary of the analysis
summary(anova)
#apply a post hoc tukey test ukey HSD (Tukey Honest Significant Differences, R function: TukeyHSD())
TukeyHSD(anova)
> Tukey multiple comparisons of means 95% family-wise confidence level > > Fit: aov(formula = variable ~ exp * cond, data = test) > > $exp > > diff lwr upr p adj > > Exp2-Exp1 0.028634582 0.02268322 0.0345859455 0.0000000 > > Exp3-Exp1 -0.006185164 -0.01285797 0.0004876468 0.0706136 > > Exp3-Exp2 -0.034819746 -0.04110199 -0.0285375024 0.0000000 > > > > $cond > diff lwr upr p adj > U-B 0.01473809 0.01059542 0.01888076 3.5e-06 > > $`exp:cond` > diff lwr upr p adj > Exp2:B-Exp1:B 0.016844040 0.006273786 0.027414294 0.0016210 > Exp3:B-Exp1:B -0.001600507 -0.012900584 0.009699570 0.9964757 > Exp1:U-Exp1:B 0.007280763 -0.004019314 0.018580840 0.3277292
#checking anova assumption validity
# 2. Homogeneity of variances
plot(anova, 1)
#Bartlett's test or Levene's test to check the homogeneity of variances.
library(car)
leveneTest(variable ~ exp*cond, data = test )
# 2. Normality
plot(anova, 2)
#confirm with shapiro
# Extract the residuals
anova_residuals <- residuals(object = anova)
# Run Shapiro-Wilk test (high P value= normalit is oK)
shapiro.test(x = anova_residuals )