2 Compact letter display(CLD):Two way anova and visualistion using ggplot2
ฝัง
- เผยแพร่เมื่อ 8 ก.ค. 2024
- #rprogramming #rprogramming #anovaplot #ggplot2 #emmeans #cld #compactletterdisplay
In this tutorial, you will learn how to effectively apply Two-Way ANOVA to analyze your data and then compute the Critical Difference (CLD) values. We will dive into the world of R programming and utilize the powerful ggplot2 library to create stunning visualizations of the CLD results. Join us to unlock the secrets of statistical analysis and take your data interpretation skills to the next level!
This is a 3 part video tutorial
part 1 : one way ANOVA and CLD : • I - Compact Letter Dis...
part 2: Two way Anova and CLD : • 2 Compact letter displ...
part 3: Three way Anova and CLD : • 3 Compact letter displ...
code
library(emmeans)
library(multcomp)
library(multcompView)
library(palmerpenguins)
head(penguins)
summary(penguins)
str(penguins)
two way factorial anova
mod2 = aov(bill_length_mm~species+sex,penguins)
summary(mod2)
emmean = emmeans(mod2,specs = c("species","sex"))
emmean_cld = cld(emmean,alpha=0.05,Letters=letters)
library(ggplot2)
ggplot(emmean_cld,aes(species , emmean,label=.group, fill=sex))+
geom_col(position="dodge")+
geom_errorbar(aes(ymin=emmean-SE, ymax=emmean+SE),
position = position_dodge(width=0.9),
width=0.1, size=0.7)+
geom_text(vjust=-0.5,
position = position_dodge(width=0.9))+
theme_classic()
Facebook page:
/ rajendrachoureisc
Mail Id:
rajuchoure@gmail.com
youtube playlist:
• R programming tutorials
My expectations were blown to smithereens (in the best way possible)! Your analysis surpassed every metric and redefined what 'great' means in statistics, Thanks for outstanding analysis.
Thanks!
It's part 2 of the tutorial. Do watch part I also.
@@DevResearch for some reason this section of code did not work for me: emmean = emmeans(mod2,specs = c("species","sex"))
emmean_cld = cld(emmean,alpha=0.05,Letters=letters)
so I had to change this section to : emmean = emmeans (mod2 , ~ species | sex)) for my own data and then I got the cld results.
Thanks again for the video: is there any way we do separate mean comparison for sexes per each species? in terms of showing CLDs?!
I am trying to wirte a script for this. But am short opf time. Will compile it soon.
@@DevResearch Thanks! you are the best
Thank you so much for sharing such kind of content. Is it possible to have a p-value in emmean table? And how to interpret the differences based on the distinct letters?
I will look for the code or possible modification to get p-values in emmean table.
Regrading interpretation of cld: the bars or boxes sharing letters are not statistically significant. When letters are different, there is a significant difference.