Bonjour à tous,

Après une anova à deux facteurs je réalise un test de mc_tuckey pour obtenir des comparaisons deux à deux.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
datalaboech$grp <- interaction(datalaboech$Auxiliaire, datalaboech$Concentration, sep="_")
datalaboech$grp
bartlett.test(residuals(mod)~datalaboech$grp)
 
mod_grp<-(lm(Compacité~grp,data=datalaboech))
 
Anova(mod_grp)
mc_tukey<-(glht(mod_grp,linfct = mcp(grp="Tukey")))
view()
summary(mc_tukey)
par(mar=c(3,7,3,3))
plot(mc_tukey)
tuk.cld <- cld(mc_tukey)
tuk.cld
 
 
letters <- tuk.cld$mcletters$Letters
 
myletters_df <- as.data.frame(grp=levels(datalaboech$grp),letters=letters)
myletters_df
ggplot(datalaboech, aes(x=grp, y=Compacité, colour=grp))+
  geom_boxplot(outlier.alpha = 0, alpha=0.5)+
  geom_jitter(width=0.25)+  
  stat_summary(fun=mean, colour="black", geom="point", 
               shape=18, size=3) +
  theme_classic()+
  theme(legend.position="none")+
  theme(axis.text.x = element_text(angle=30, hjust=1, vjust=1))+
  geom_text(data = myletters_df, aes(label = letters, y = 0.4 ), colour="black", size=5)


Je veux afficher les résultats des différences significatives ou non, sous forme de lettre sur mon boxplot. Différences représenté ci-dessous :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
>letters
    Misc_C1,5      PFB_C1,5      PFM_C1,5 Tixo 38A_C1,5  Tixo 68_C1,5        BRL_C3       Misc_C3        PFB_C3 
         "ab"         "fgh"           "i"         "abc"          "ag"      "cdefgh"          "ab"        "efgh" 
       PFM_C3   Tixo 38A_C3    Tixo 68_C3        BRL_C6        BRR_C6       Misc_C6        PFB_C6        PFM_C6 
       "efgh"         "abd"          "ab"         "abe"         "fgh"           "a"         "bgh"       "defgh" 
  Tixo 38A_C6    Tixo 68_C6   T BESB25_CT     T ES25_CT    T ESB25_CT 
         "ab"         "abf"         "fgh"          "gh"           "h"

Je ne peux pas passer en data frame pour l'incorporation à l'aide de la fonction gom_text.
J'espère que quelqu'un pourra m'aiguiller.

Merci

Guillaume Buffet