library(readxl)
library(ggpubr)
## Loading required package: ggplot2
#library(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)
library(rstatix)
##
## Attaching package: 'rstatix'
## The following objects are masked from 'package:effectsize':
##
## cohens_d, eta_squared
## The following object is masked from 'package:stats':
##
## filter
A6Q3<-read_excel("A6Q3-1.xlsx")
A6Q3
## # A tibble: 50 × 2
## exercisetype bodyweight
## <chr> <dbl>
## 1 nocardio 56.5
## 2 nocardio 76.7
## 3 nocardio 71.2
## 4 nocardio 60.9
## 5 nocardio 80.0
## 6 nocardio 73.4
## 7 nocardio 67.6
## 8 nocardio 77.2
## 9 nocardio 77.0
## 10 nocardio 76.6
## # ℹ 40 more rows
A6Q3 %>%
group_by(exercisetype) %>%
summarise(
Mean = mean(bodyweight, na.rm = TRUE),
Median = median(bodyweight, na.rm = TRUE),
SD = sd(bodyweight, na.rm = TRUE),
N = n()
)
## # A tibble: 2 × 5
## exercisetype 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
hist(A6Q3$bodyweight[A6Q3$exercisetype == "nocardio"],
main = "Histogram of nocardio bodyweight",
xlab = "Value",
ylab = "Frequency",
col = "lightblue",
border = "black",
breaks = 10)
hist(A6Q3$bodyweight[A6Q3$exercisetype == "cardio"],
main = "Histogram of Cardio bodyweight",
xlab = "Value",
ylab = "Frequency",
col = "lightgreen",
border = "black",
breaks = 10)
#Group 1: No Cardio #The first variable looks normally distributed. #The
data is symmetrical. #The data has a proper bell curve.
#Group 2: Cardio #The second variable looks normally distributed. #The data is symmetrical. #The data has a proper bell curve.
ggboxplot(A6Q3, x = "exercisetype", y = "bodyweight",
color = "exercisetype",
palette = "jco",
add = "jitter")
#Boxplot 1: No cardio #There are dots outside the boxplot. #The dot is
close to the whisker. #Based on these findings, the boxplot is
normal.
#Boxplot 2: Cardio #There are dots outside the boxplot. #The dots are close to the whiskers. #Based on these findings, the boxplot is not normal.
shapiro.test(A6Q3$bodyweight[A6Q3$exercisetype == "nocardio"])
##
## Shapiro-Wilk normality test
##
## data: A6Q3$bodyweight[A6Q3$exercisetype == "nocardio"]
## W = 0.97686, p-value = 0.8166
shapiro.test(A6Q3$bodyweight[A6Q3$exercisetype == "cardio"])
##
## Shapiro-Wilk normality test
##
## data: A6Q3$bodyweight[A6Q3$exercisetype == "cardio"]
## W = 0.96745, p-value = 0.5812
#Group 1: No cardio #The first group is normally distributed, (p = .81).
#Group 2: Cardio #The second group is normally distributed, (p = .581).
t.test(bodyweight ~ exercisetype, data = A6Q3, var.equal = TRUE)
##
## Two Sample t-test
##
## data: bodyweight by exercisetype
## 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
wilcox.test(bodyweight ~ exercisetype, data = A6Q3)
##
## Wilcoxon rank sum exact test
##
## data: bodyweight by exercisetype
## W = 399, p-value = 0.09541
## alternative hypothesis: true location shift is not equal to 0
#An Independent T-Test was conducted to determine if there was a difference in bodyweight between no lift and lift. #cardio (M = 70.81, SD = 7.50) were significantly different from no cardio (M = 74.73, SD = 7.3), t(48) = 1.8, p = .09.
#A Mann-Whitney U test was conducted to determine if there was a difference in bodyweight between cardio and no cardio. #cardio (Mdn = 73.25620) were significantly different from no cardio (Mdn = 69.50471), U = 399, p = .09.