Analysis of Variance (ANOVA) in R | Tukey's HSD Test, Visualization, Assumption Check, Normality

Описание к видео Analysis of Variance (ANOVA) in R | Tukey's HSD Test, Visualization, Assumption Check, Normality

How to apply an analysis of variance (ANOVA) in the R programming language. Explore my online course on Statistical Methods in R to dive deeper into this and related topics: https://statisticsglobe.com/online-co...

R code of this video:

install.packages("ggplot2") # Install & load packages
install.packages("car")

library(ggplot2)
library(car)

data("mtcars") # Load the data
head(mtcars)

mtcars$cyl <- as.factor(mtcars$cyl) # Modify data class

anova_result <- aov(mpg ~ cyl, # Perform ANOVA
data = mtcars)
summary(anova_result)

tukey_result <- TukeyHSD(anova_result) # Post-hoc analysis
tukey_result

plot(tukey_result, # Plot Tukey's HSD
xlim = c(-15, 15))

ggplot(mtcars, # Visualize results
aes(x = cyl,
y = mpg)) +
geom_boxplot() +
labs(title = "Boxplot of MPG by Cylinder Count",
x = "Number of Cylinders",
y = "Miles Per Gallon (MPG)")

plot(anova_result, 2) # Check normality of residuals

leveneTest(mpg ~ cyl, # Homogeneity of variance
data = mtcars)

Follow me on Social Media:
Facebook – Statistics Globe Page:   / statisticsglobecom  
Facebook – R Programming Group for Discussions & Questions:   / statisticsglobe  
Facebook – Python Programming Group for Discussions & Questions:   / statisticsglobepython  
LinkedIn – Statistics Globe Page:   / statisticsglobe  
LinkedIn – R Programming Group for Discussions & Questions:   / 12555223  
LinkedIn – Python Programming Group for Discussions & Questions:   / 12673534  
Twitter:   / joachimschork  
Instagram:   / statisticsglobecom  
TikTok:   / statisticsglobe  

Комментарии

Информация по комментариям в разработке