R Markdown

library(readxl)
library(ggpubr)
## Loading required package: ggplot2
#library(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)
library(rstatix)
## 
## Attaching package: 'rstatix'
## The following objects are masked from 'package:effectsize':
## 
##     cohens_d, eta_squared
## The following object is masked from 'package:stats':
## 
##     filter
A6Q4<-read_excel("A6Q4-1.xlsx")
A6Q4
## # A tibble: 50 × 2
##    exercise bodyweight
##    <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
##  7 nolift        69.7 
##  8 nolift        79.6 
##  9 nolift       -13.9 
## 10 nolift        40.8 
## # ℹ 40 more rows
A6Q4 %>%
  group_by(exercise) %>%
  summarise(
    Mean = mean(bodyweight, na.rm = TRUE),
    Median = median(bodyweight, na.rm = TRUE),
    SD = sd(bodyweight, 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$bodyweight[A6Q4$exercise == "nolift"],
     main = "Histogram of nolift bodyweight",
     xlab = "Value",
     ylab = "Frequency",
     col = "lightblue",
     border = "black",
     breaks = 10)

hist(A6Q4$bodyweight[A6Q4$exercise == "lift"],
     main = "Histogram of lift bodyweight",
     xlab = "Value",
     ylab = "Frequency",
     col = "lightgreen",
     border = "black",
     breaks = 10)

#Group 1: No Lift #The first variable looks abnormally distributed. #The data is negative skewed. #The data has no a proper bell curve.

#Group 2: Lift #The second variable looks abnormally distributed. #The data is negatively skewed. #The data has no a proper bell curve.

ggboxplot(A6Q4, x = "exercise", y = "bodyweight",
          color = "exercise",
          palette = "jco",
          add = "jitter")

#Boxplot 1: No Lift
#There are dots outside the boxplot.
#The dot is close to the whisker.
#Based on these findings, the boxplot is normal.

#Boxplot 2: Lift
#There are dots outside the boxplot.
#The dots are close to the whiskers.
#The outliers are not balanced.
#Based on these findings, the boxplot is not normal.

shapiro.test(A6Q4$bodyweight[A6Q4$exercise == "nolift"])
## 
##  Shapiro-Wilk normality test
## 
## data:  A6Q4$bodyweight[A6Q4$exercise == "nolift"]
## W = 0.70002, p-value = 7.294e-06
shapiro.test(A6Q4$bodyweight[A6Q4$exercise == "lift"])
## 
##  Shapiro-Wilk normality test
## 
## data:  A6Q4$bodyweight[A6Q4$exercise == "lift"]
## W = 0.78786, p-value = 0.0001436

#Group 1: No Lift #The first group is abnormally distributed, (p < .05).

#Group 2: Lift #The second group is abnormally distributed, (p < .05).

t.test(bodyweight ~ exercise, data = A6Q4, var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  bodyweight 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(bodyweight ~ exercise, data = A6Q4)
## 
##  Wilcoxon rank sum exact test
## 
## data:  bodyweight by exercise
## W = 603, p-value = 7.132e-11
## alternative hypothesis: true location shift is not equal to 0
cohens_d_result <- cohen.d(bodyweight ~ exercise, data = A6Q4, pooled_sd = TRUE)
print(cohens_d_result)
## 
## Cohen's d
## 
## d estimate: 1.581752 (large)
## 95 percent confidence interval:
##     lower     upper 
## 0.9301721 2.2333327
mw_effect <- cliff.delta(bodyweight ~ 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 bodyweight between nolift and lift
#No lift scores (M = 33.02525, SD = 56.70695) were significantly different from lift (M = 120.08238, SD = 53.31766), t(48) = 5.5, p < .05.
#The effect size was medium, Cohen’s d = .93.

#A Mann-Whitney U test was conducted to determine if there was a difference in bodyweight between no lift and lift.
#no lift (Mdn = 40.83) were significantly different from lift (Mdn = 115.6), U = 603, p < .05. #The effect size was large, Cliff’s Delta = .93.

#https://rpubs.com/jishimwe1/1426233