library(readxl)
library(effsize)
A6Q3 <- read_excel("C:/Users/nehab/OneDrive/A5221/Assignment 6/A6Q3.xlsx")
# Check the cardio groups
table(A6Q3$Exercise)
##
## cardio nocardio
## 25 25
# Descriptive statistics for each group
aggregate(
Weight ~ Exercise,
data = A6Q3,
FUN = mean
)
## Exercise Weight
## 1 cardio 74.73336
## 2 nocardio 70.81710
aggregate(
Weight ~ Exercise,
data = A6Q3,
FUN = sd
)
## Exercise Weight
## 1 cardio 7.573859
## 2 nocardio 7.350987
aggregate(
Weight ~ Exercise,
data = A6Q3,
FUN = median
)
## Exercise Weight
## 1 cardio 73.25620
## 2 nocardio 69.50471
# Examine weight distributions for both groups
boxplot(
Weight ~ Exercise,
data = A6Q3,
main = "Body Weight by Cardio Exercise",
xlab = "Regular Cardio Exercise",
ylab = "Body Weight"
)
# Test normality separately for both groups
by(
A6Q3$Weight,
A6Q3$Exercise,
shapiro.test
)
## A6Q3$Exercise: cardio
##
## Shapiro-Wilk normality test
##
## data: dd[x, ]
## W = 0.96745, p-value = 0.5812
##
## ------------------------------------------------------------
## A6Q3$Exercise: nocardio
##
## Shapiro-Wilk normality test
##
## data: dd[x, ]
## W = 0.97686, p-value = 0.8166
# Both groups are normally distributed because both p-values are greater than .05.
# The boxplot does not show serious outliers.
# Therefore, an Independent T-Test will be used.
# Conduct the Independent T-Test
t.test(
Weight ~ Exercise,
data = A6Q3,
na.action = na.omit
)
##
## Welch Two Sample t-test
##
## data: Weight by Exercise
## t = 1.8552, df = 47.957, p-value = 0.06972
## alternative hypothesis: true difference in means between group cardio and group nocardio is not equal to 0
## 95 percent confidence interval:
## -0.3281432 8.1606600
## sample estimates:
## mean in group cardio mean in group nocardio
## 74.73336 70.81710
# Calculate Cohen's d effect size
cohen.d(
Weight ~ Exercise,
data = A6Q3,
na.rm = TRUE
)
##
## Cohen's d
##
## d estimate: 0.5247387 (medium)
## 95 percent confidence interval:
## lower upper
## -0.05365882 1.10313613
An independent t-test was conducted to compare body weight between participants who regularly do cardio and participants who do not. There was no statistically significant difference between the cardio group (M = 74.73, SD = 7.57) and the no-cardio group (M = 70.82, SD = 7.35), t(47.96) = 1.86, p = .070. The effect size was medium (Cohen’s d = 0.52). Therefore, the null hypothesis was not rejected.