library(readxl)
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(ggpubr)
## Loading required package: ggplot2
library(rstatix)
##
## Attaching package: 'rstatix'
## The following objects are masked from 'package:effectsize':
##
## cohens_d, eta_squared, omega_squared
## The following object is masked from 'package:stats':
##
## filter
A6Q3 <- read_excel("//apporto.com/dfs/SLU/Users/brentgallagher_slu/Desktop/A6Q3.xlsx")
A6Q3 %>%
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 cardio 74.7 73.3 7.57 25
## 2 nocardio 70.8 69.5 7.35 25
# Cardio - Mean 74.7, Median 73.3, SD 7.57
# No Cardio - Mean 70.8, Median 69.6, SD 7.35
hist(A6Q3$Weight[A6Q3$Exercise ==
"cardio"],
breaks = 15,
col = "skyblue",
border = "white")

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

# Data for group one appears abnormally distributed.
# Data for group two appears abnormally distributed.
ggboxplot(A6Q3, x ="Exercise", y = "Weight",
color = "Exercise",
palette = "jco",
add = "jitter")

# Group one does have outliers.
# Group two does have outliers.
shapiro.test(A6Q3$Weight[A6Q3$Exercise == "cardio"])
##
## Shapiro-Wilk normality test
##
## data: A6Q3$Weight[A6Q3$Exercise == "cardio"]
## W = 0.96745, p-value = 0.5812
shapiro.test(A6Q3$Weight[A6Q3$Exercise == "nocardio"])
##
## Shapiro-Wilk normality test
##
## data: A6Q3$Weight[A6Q3$Exercise == "nocardio"]
## W = 0.97686, p-value = 0.8166
# The first group is normally distributed, (p > .05) p-value = 0.58
# The second group is normally distributed, (p > .05) p-value = 0.82
t.test(Weight ~ Exercise,
data = A6Q3, var.equal = TRUE)
##
## Two Sample t-test
##
## data: Weight by Exercise
## t = 1.8552, df = 48, p-value = 0.06971
## alternative hypothesis: true difference in means between group cardio and group nocardio is not equal to 0
## 95 percent confidence interval:
## -0.3280454 8.1605622
## sample estimates:
## mean in group cardio mean in group nocardio
## 74.73336 70.81710
# Mean Cardio 74.73
# Mean No Cardio 70.81
cohens_d_result <- effectsize::cohens_d(
Weight ~ Exercise,
data = A6Q3,
pooled_sd = TRUE
)
print(cohens_d_result)
## Cohen's d | 95% CI
## -------------------------
## 0.52 | [-0.04, 1.09]
##
## - Estimated using pooled SD.
# Cohen's d = 0.52
# An Independent T-test was conducted to determine if there was a difference in Outcome Varibale between Group 1 and Group 2.
# Group 1 scores (M = 73.30, SD= 7.57) were not significatly different from Group 2 scores (M = 69.60, SD = 7.35).
# The effect size was medium, Cohen's d = 0.52.