library(readxl)
A6Q2 <- read_excel("C:/Users/wmacklin/Downloads/A6Q2.xlsx")
difference <- A6Q2$After - A6Q2$Before
shapiro.test(difference)
##
## Shapiro-Wilk normality test
##
## data: difference
## W = 0.89142, p-value = 0.02856
wilcox.test(A6Q2$Before,
A6Q2$After,
paired = TRUE)
##
## Wilcoxon signed rank exact test
##
## data: A6Q2$Before and A6Q2$After
## V = 210, p-value = 1.907e-06
## alternative hypothesis: true location shift is not equal to 0
boxplot(A6Q2$Before,
A6Q2$After,
names = c("Before", "After"),
main = "Body Weight Before and After Keto Diet",
ylab = "Body Weight (kg)")
A Shapiro-Wilk test indicated that the differences in body weight were not normally distributed (W = 0.89142, p = 0.02856). Therefore, a Wilcoxon signed-rank test was conducted. The results showed a statistically significant difference in body weight before and after participants followed the keto diet, V = 210, p < .001. These findings indicate that body weight changed significantly after participants tried the keto diet.