library(readxl)
A6Q4 <- read_excel("C:/Users/SHRUTI/Downloads/A6Q4.xlsx")
names(A6Q4)
## [1] "Exercise" "Weight"
head(A6Q4)
## # A tibble: 6 × 2
## Exercise Weight
## <chr> <dbl>
## 1 nolift 25.8
## 2 nolift 30.1
## 3 nolift 7.17
## 4 nolift 88.7
## 5 nolift 66.1
## 6 nolift 3.29
table(A6Q4$Exercise)
##
## lift nolift
## 25 25
# install.packages("dplyr")
# install.packages("effectsize")
# install.packages("effsize")
library(readxl)
library(ggpubr)
## Loading required package: ggplot2
library(dplyr)
##
## 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)
library(effsize)
# Descriptive statistics by group
A6Q4 %>%
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
# Histograms
hist(A6Q4$Weight[A6Q4$Exercise == "lift"],
breaks = 15,
col = "skyblue",
border = "white")

hist(A6Q4$Weight[A6Q4$Exercise == "nolift"],
breaks = 15,
col = "firebrick",
border = "white")

# Boxplot
ggboxplot(A6Q4, x = "Exercise", y = "Weight",
color = "Exercise",
palette = "jco",
add = "jitter")

# Shapiro-Wilk for each group
shapiro.test(A6Q4$Weight[A6Q4$Exercise == "lift"])
##
## Shapiro-Wilk normality test
##
## data: A6Q4$Weight[A6Q4$Exercise == "lift"]
## W = 0.78786, p-value = 0.0001436
shapiro.test(A6Q4$Weight[A6Q4$Exercise == "nolift"])
##
## Shapiro-Wilk normality test
##
## data: A6Q4$Weight[A6Q4$Exercise == "nolift"]
## W = 0.70002, p-value = 7.294e-06
# Data for the lift group appears abnormally distributed (positively skewed, with a long right tail).
# Data for the nolift group appears abnormally distributed (negatively skewed, with one extreme low value).
# The lift boxplot has outliers.
# The nolift boxplot has an outlier (a negative weight of about -200, which is impossible and likely a data error; it was kept because the Mann-Whitney U test is based on ranks).
# The lift group is abnormally distributed, (p < .001).
# The nolift group is abnormally distributed, (p < .001).
# Both Shapiro-Wilk tests were abnormal, so a Mann-Whitney U Test is appropriate.
wilcox.test(Weight ~ Exercise, data = A6Q4)
##
## 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
cliff.delta(Weight ~ Exercise, data = A6Q4)
##
## Cliff's Delta
##
## delta estimate: 0.9296 (large)
## 95 percent confidence interval:
## lower upper
## 0.7993841 0.9764036
# A Mann-Whitney U Test was conducted to determine if there was a difference in weight between the lift and nolift groups.
# Lift scores (Mdn = 116) were significantly different from Nolift scores (Mdn = 40.8), W = 603, p < .001.
# The effect size was large, Cliff's delta = 0.93.