Open the Installed Packages
library(readxl)
library(ggpubr)
## Loading required package: 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)
Import and Name the Dataset
A6Q3 <- read_excel("C:/Users/krish/Downloads/A6Q3-2.xlsx")
Calculate the Descriptive Statistics
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
Create Histograms (Normality Check #1)
hist(A6Q3$Weight[A6Q3$Exercise == "cardio"],
main = "Histogram of Cardio",
xlab = "Value",
ylab = "Frequency",
col = "lightyellow",
border = "black",
breaks = 10)
hist(A6Q3$Weight[A6Q3$Exercise == "nocardio"],
main = "Histogram of Nocardio",
xlab = "Value",
ylab = "Frequency",
col = "brown",
border = "black",
breaks = 10)
Interpret the Histograms
Group 1: cardio
The first variable looks normally distributed.
The data is symmetrical.
The data has a proper bell curve.
Group 2: nocardio
The second variable looks normally distributed.
The data is symmetrical.
The data has a proper bell curve.
Create Boxplots for Outliers (Normality Check #2)
ggboxplot(A6Q3, x = "Exercise", y = "Weight",
color = "Exercise",
palette = "jco",
add = "jitter")
Interpret the Boxplots
Boxplot 1: Nocardio
There are dots outside the boxplot.
The dots are close to the whiskers
The dots are not very far away from the whisker
Based on this findings,the boxplot is normal
Boxplot 2: Cardio
There are dots outside the boxplot.
The dots are close to the whiskers
The dots are not very far away from the whisker
Based on this findings,the boxplot is normal
Shapiro-Wilk Tests (Normality Check #3)
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
Interpret the Shapiro-Wilk Test Group 1: Exercise
The first group is normally distributed, p >.05.
Group 2: Weight
The second group is normally distributed, p >.05.
Conduct the Independent T-Test
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
Report the Independent T-Test
An Independent T-Test was conducted to determine if there was a difference in Weight between cardio and nocardio.
Cardio scores (M = 74.7, SD = 7.57) were not significantly different from nocardio scores (M = 70.8, SD = 7.35), t(48) = 1.85, p >0.05.