Is there a difference in mean body weight (kg) between participants who do cardio versus participants who do not do cardio?

Load Required Packages

library(readxl)
## Warning: package 'readxl' was built under R version 4.6.1
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.6.1
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.6.1
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(rmarkdown)

Import dataset

A6Q3_2 <- read_excel("C:/Users/rteno/OneDrive - Saint Louis University/AA 5221/Assignment 6/Question 3/A6Q3-2.xlsx")

Calculate the Descriptive Statistics

A6Q3_2 %>%
  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

Create Histogram (Normality Check #1)

# Histogram for cardio
hist(A6Q3_2$Weight[A6Q3_2$Exercise == "cardio"],
     main = "Histogram of cardio Weight",
     xlab = "Value",
     ylab = "Frequency",
     col = "lightgreen",
     border = "black",
     breaks = 10)

# Histogram for nocardio
hist(A6Q3_2$Weight[A6Q3_2$Exercise == "nocardio"],
     main = "Histogram of nocardio Weight",
     xlab = "Value",
     ylab = "Frequency",
     col = "lightblue",
     border = "black",
     breaks = 10)

# Interpret the Histograms
#Group 1: cardio
#The cardio group looks normally distributed.
#The data is symmetrical.
#The data has a proper bell curve.

#Group 2: nocardio
#The nocardio group looks normally distributed.
#The data is symmetrical.
#The data has a proper bell curve.

Create Boxplots for Outliers (Normality Check #2)

ggboxplot(A6Q3_2, 
          x = "Exercise", 
          y = "Weight",
          color = "Exercise",
          palette = "jco",
          add = "jitter")

# Interpret the Boxplots
# Boxplot 1: cardio
# There is no dot outside the boxplot.
# Based on these findings, the boxplot is normal.

# Boxplot 2: nocardio
# There is no dot outside the boxplot.
# Based on these findings, the boxplot is normal.

Shapiro-Wilk Tests (Normality Check #3)

shapiro.test(A6Q3_2$Weight[A6Q3_2$Exercise == "cardio"])
## 
##  Shapiro-Wilk normality test
## 
## data:  A6Q3_2$Weight[A6Q3_2$Exercise == "cardio"]
## W = 0.96745, p-value = 0.5812
shapiro.test(A6Q3_2$Weight[A6Q3_2$Exercise == "nocardio"])
## 
##  Shapiro-Wilk normality test
## 
## data:  A6Q3_2$Weight[A6Q3_2$Exercise == "nocardio"]
## W = 0.97686, p-value = 0.8166
# Interpret the Shapiro-Wilk Tests
# Group 1: cardio
# The cardio group is normally distributed, (p = .582).

# Group 2: nocardio
# The nocardio group is normally distributed, (p = .817).

Determine Overall Normality

# Histograms: Normal
# Boxplots: Normal
# Shapiro-Wilks: Normal
# Overall Decision: Normal

Conduct the Independent T-Test

t.test(Weight ~ Exercise, data = A6Q3_2, 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

Report the Independent T-Test

# An Independent T-Test was conducted to determine if there was a difference in 
# body weight between participants who do cardio and participants who do not do cardio.
# The cardio scores (M = 74.73, SD = 7.57) were not significantly different 
# nocardio scores (M = 70.82, SD = 7.35), t(48) = 1.86, p > .05.