library(readxl)
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.6.1
## Loading required package: ggplot2
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(dplyr)
A6Q4 <- read_excel("C:/Users/Tharu/Downloads/A6Q4.xlsx")
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
hist(A6Q4$Weight[A6Q4$Exercise == "nolift"],
main = "Histogram of Weight - No lift",
xlab = "Value",
ylab = "Frequency",
col = "lightblue",
border = "black",
breaks = 10)
hist(A6Q4$Weight[A6Q4$Exercise == "lift"],
main = "Histogram of Weight - lift",
xlab = "Value",
ylab = "Frequency",
col = "lightgreen",
border = "black",
breaks = 10)
#Group 1: No lift #The first variable is approximately normally
distributed, but not perfectly. #The data is moderately symmetrical,
with a slight left-skew due to a low outlier (around -200). #The data
shows a general bell-shaped pattern, although there is some deviation
caused by the negative extreme value.
#Group 2: Lift #The second variable is not perfectly normally distributed. #The data is clearly right-skewed due to a few high extreme values (around 220 and 300). #The data does not form a perfect bell-shaped pattern because of these outliers, even though most values are clustered between 0 and 100.
ggboxplot(A6Q4, x = "Exercise", y = "Weight",
color = "Exercise",
palette = "jco",
add = "jitter")
#Boxplot 1: Group 1 (nolift)
#There are dots outside the boxplot. #The dots are not close to the whiskers. #The dots are very far away from the whiskers. #The outliers are not balanced. #Based on these findings, the boxplot is not normal.
#Boxplot 2: Group 2 (lift)
#There are dots outside the boxplot. #The dots are not close to the whiskers. #The dots are very far away from the whiskers. #The outliers are not balanced. #Based on these findings, the boxplot is not normal
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
shapiro.test(A6Q4$Weight[A6Q4$Exercise == "lift"])
##
## Shapiro-Wilk normality test
##
## data: A6Q4$Weight[A6Q4$Exercise == "lift"]
## W = 0.78786, p-value = 0.0001436
#Group 1: nocardio #The first group is abnormally distributed, (p = 7.294e-06).
#Group 2: cardio #The second group is normally distributed, (p = 0.0001436).
t.test(Weight ~ Exercise, data = A6Q4, var.equal = TRUE)
##
## Two Sample t-test
##
## data: Weight by Exercise
## t = 5.5923, df = 48, p-value = 1.045e-06
## alternative hypothesis: true difference in means between group lift and group nolift is not equal to 0
## 95 percent confidence interval:
## 55.75715 118.35710
## sample estimates:
## mean in group lift mean in group nolift
## 120.08238 33.02525
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
cohens_d_result <- cohens_d(Weight ~ Exercise, data = A6Q4)
cohens_d_result
## Cohen's d | 95% CI
## ------------------------
## 1.58 | [0.94, 2.21]
##
## - Estimated using pooled SD.
mw_effect <- cliff.delta(Weight ~ Exercise, data = A6Q4)
print(mw_effect)
##
## Cliff's Delta
##
## delta estimate: 0.9296 (large)
## 95 percent confidence interval:
## lower upper
## 0.7993841 0.9764036
#An Independent T-Test was conducted to determine if there was a difference in Weight between lift and nolift. #lift scores (M = 120.00, SD = 53.30) were significantly different from nolift scores (M = 33.00, SD = 56.70), t(48) = 5.59, p < .001. #The effect size was very large, Cohen’s d = 1.58.
#A Mann-Whitney U test was conducted to determine if there was a difference in Weight between lift and nolift. #lift scores (Mdn = 116.0) were significantly different from nolift scores (Mdn = 40.8), U = 603, p < .001.