##Opening libraries
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)
##Importing data
A6Q3_2 <- read_excel("A6Q3-2.xlsx")
##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
##Histogram of Groups (Exercise v Weight)
hist(A6Q3_2$Weight,
main = "Histogram of Exercise v Weight",
xlab = "Weight (kg)",
ylab = "Exercise Frequency",
col = "brown",
border = "black",
breaks = 10)
##Histogram Report #Group Report The first variable looks normally distributed. The data is symmetrical. The data has a proper bell curve.
##Boxplots of Groups (Exercise, Weight)
ggboxplot(A6Q3_2, x = "Exercise", y = "Weight",
color = "brown",
palette = "jco",
add = "jitter")
##Boxplot Report. #Boxplot. There are dots outside the boxplot. The dots are close to the whiskers. The dots are closer to the whiskers. The outliers are balanced. Based on these findings, the boxplot is normal.
##Shapiro-WIlk Test
shapiro.test(A6Q3_2$Weight)
##
## Shapiro-Wilk normality test
##
## data: A6Q3_2$Weight
## W = 0.97966, p-value = 0.5378
##Group: Exercise v Weight The group is normally distibuted, (p = .53) Data is normal.
##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
##Cohens-d
cohens_d_result <- cohens_d(Weight ~ Exercise, data = A6Q3_2, pooled_sd = TRUE)
print(cohens_d_result)
## Cohen's d | 95% CI
## -------------------------
## 0.52 | [-0.04, 1.09]
##
## - Estimated using pooled SD.
##Summary of Group tested. An Independent T-Test was conducted to determine if there was a difference in Weight between nocardio and cardio participants. No cardio scores (M = 74.73, SD = 7.57) were not significantly different from Male scores (M = 70.81, SD = 7.35), t(48) = 1.855, p = .006. The effect size was medium, Cohen’s d = .52.