Is there a difference in body weight (kg) between participants who
lift weights versus participants who do not lift weights?
Load Required Packages
library(readxl)
## Warning: package 'readxl' was built under R version 4.6.1
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.6.1
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.6.1
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.6.1
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(effectsize)
## Warning: package 'effectsize' was built under R version 4.6.1
library(effsize)
## Warning: package 'effsize' was built under R version 4.6.1
library(rmarkdown)
Import dataset
A6Q4_2 <- read_excel("C:/Users/rteno/OneDrive - Saint Louis University/AA 5221/Assignment 6/Question 4/A6Q4-2.xlsx")
Calculate the Descriptive Statistics
A6Q4_2 %>%
group_by(Exercise) %>%
summarise(
Mean = mean(Weight, na.rm = TRUE),
Median = median(Weight, na.rm = TRUE),
SD = sd(Weight, na.rm = TRUE),
N = n()
)
## # A tibble: 2 × 5
## Exercise Mean Median SD N
## <chr> <dbl> <dbl> <dbl> <int>
## 1 lift 120. 116. 53.3 25
## 2 nolift 33.0 40.8 56.7 25
Create Histograms (Normality Check #1)
# Histogram for lift
hist(A6Q4_2$Weight[A6Q4_2$Exercise == "lift"],
main = "Histogram of lift Weight",
xlab = "Value",
ylab = "Frequency",
col = "lightgreen",
border = "black",
breaks = 10)

# Histogram for nolift
hist(A6Q4_2$Weight[A6Q4_2$Exercise == "nolift"],
main = "Histogram of nolift Weight",
xlab = "Value",
ylab = "Frequency",
col = "lightblue",
border = "black",
breaks = 10)

# Interpret the Histograms
#Group 1: lift
#The lift group looks abnormally distributed.
#The data is positively skewed.
#The data does not have a proper bell curve.
#Group 2: nolift
#The nolift group looks abnormally distributed.
#The data is negatively skewed.
#The data does not have a proper bell curve.
Create Boxplots for Outliers (Normality Check #2)
ggboxplot(A6Q4_2,
x = "Exercise",
y = "Weight",
color = "Exercise",
palette = "jco",
add = "jitter")

# Interpret the Boxplots
# Boxplot 1: lift
# There are two dots outside the boxplot.
# The dots are not close to the whisker.
# The dots are very far away from the whisker.
# Based on these findings, the boxplot is abnormal.
# Boxplot 2: nolift
# There is one dot outside the boxplot.
# The dot is not close to the whisker.
# The dot is very far away from the whisker.
# Based on these findings, the boxplot is abnormal.
Shapiro-Wilk Tests (Normality Check #3)
shapiro.test(A6Q4_2$Weight[A6Q4_2$Exercise == "lift"])
##
## Shapiro-Wilk normality test
##
## data: A6Q4_2$Weight[A6Q4_2$Exercise == "lift"]
## W = 0.78786, p-value = 0.0001436
shapiro.test(A6Q4_2$Weight[A6Q4_2$Exercise == "nolift"])
##
## Shapiro-Wilk normality test
##
## data: A6Q4_2$Weight[A6Q4_2$Exercise == "nolift"]
## W = 0.70002, p-value = 7.294e-06
# Interpret the Shapiro-Wilk Tests
# Group 1: lift
# The lift group is abnormally distributed, (p <.001).
# Group 2: nolift
# The nolift group is abnormally distributed, (p <.001).
Determine Overall Normality
# Histograms: Abnormal
# Boxplots: Abnormal
# Shapiro-Wilks: Abnormal
# Overall Decision: Abnormal
Conduct the Mann-Whitney U
wilcox.test(Weight ~ Exercise, data = A6Q4_2)
##
## Wilcoxon rank sum exact test
##
## data: Weight by Exercise
## W = 603, p-value = 7.132e-11
## alternative hypothesis: true location shift is not equal to 0
Calculate Effect Size for Mann-Whitney U
mw_effect <- cliff.delta(Weight ~ Exercise, data = A6Q4_2)
print(mw_effect)
##
## Cliff's Delta
##
## delta estimate: 0.9296 (large)
## 95 percent confidence interval:
## lower upper
## 0.7993841 0.9764036
Report the Mann-Whitney U
# A Mann-Whitney U Test was conducted to determine if there was a difference in
# body weight between participants who lift weights and participants who do not lift weights.
# Lift scores (Mdn = 116.00) were significantly different from nolift scores
# (Mdn = 40.80), U = 603, p < .001.
# The effect size was large, Cliff's Delta = .93.