library(readxl)
library(rstatix)
## 
## Attaching package: 'rstatix'
## The following object is masked from 'package:stats':
## 
##     filter
A6Q3 <- read_excel("C:/Users/DeSheila Hatcher/OneDrive/AA 5221/Assignment 6/A6Q3.xlsx")

Cardio <- A6Q3$Weight[A6Q3$Exercise == "cardio"]
NoCardio <- A6Q3$Weight[A6Q3$Exercise == "nocardio"]

mean(Cardio, na.rm = TRUE)
## [1] 74.73336
median(Cardio, na.rm = TRUE)
## [1] 73.2562
sd(Cardio, na.rm = TRUE)
## [1] 7.573859
mean(NoCardio, na.rm = TRUE)
## [1] 70.8171
median(NoCardio, na.rm = TRUE)
## [1] 69.50471
sd(NoCardio, na.rm = TRUE)
## [1] 7.350987
shapiro.test(Cardio)
## 
##  Shapiro-Wilk normality test
## 
## data:  Cardio
## W = 0.96745, p-value = 0.5812
shapiro.test(NoCardio)
## 
##  Shapiro-Wilk normality test
## 
## data:  NoCardio
## W = 0.97686, p-value = 0.8166
t.test(Weight ~ Exercise, data = A6Q3)
## 
##  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
cohens_d(Weight ~ Exercise, data = A6Q3)
## # A tibble: 1 × 7
##   .y.    group1 group2   effsize    n1    n2 magnitude
## * <chr>  <chr>  <chr>      <dbl> <int> <int> <ord>    
## 1 Weight cardio nocardio   0.525    25    25 moderate

An independent-samples t-test was conducted to determine whether weight differed between participants who completed cardio exercise and those who did not. Participants in the cardio group (M = 74.73) had a higher mean weight than participants in the no-cardio group (M = 70.82), but the difference was not statistically significant, t(47.96) = 1.86, p = .070. The effect size was moderate, Cohen’s d = 0.53.