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)
A6Q4xlsx <- read_excel("A6Q4xlsx.xlsx")
A6Q4xlsx%>%
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 lift 120. 116. 53.3 25
## 2 nolift 33.0 40.8 56.7 25
hist(A6Q4xlsx$Weight[A6Q4xlsx$Exercise== "nolift"],
main = "Histogram of nolift",
xlab = "Exercise",
ylab = "Weight",
col = "lightblue",
border = "black",
breaks = 10)

hist(A6Q4xlsx$Weight[A6Q4xlsx$Exercise== "lift"],
main = "Histogram of lift",
xlab = "Exercise",
ylab = "Weight",
col = "lightgreen",
border = "black",
breaks = 10)

#Group 1: lift
#The first variable looks abnormally distributed.
#The data is positively skewed.
#The data does not have a proper bell curve.
#Group 2: nolift
#The second variable looks abnormally distributed.
#The data is negatively skewed.
#The data does not have a proper bell curve.
ggboxplot(A6Q4xlsx, x = "Exercise", y = "Weight",
color = "blue",
palette = "jco",
add = "jitter")

#Boxplot 1: nolife
#There are dots outside the boxplot.
#The dots are close to the whiskers.
#The dots are not very far away from the whiskers.
#The outliers are not balanced.
#Based on these findings, the boxplot is normal
#Boxplot 2: lift
#There are dots outside the boxplot.
#The dots are close to the whiskers.
#The dots are not very far away from the whiskers.
#The outliers are not balanced.
#Based on these findings, the boxplot is normal
shapiro.test(A6Q4xlsx$Weight[A6Q4xlsx$Exercise == "nolift"])
##
## Shapiro-Wilk normality test
##
## data: A6Q4xlsx$Weight[A6Q4xlsx$Exercise == "nolift"]
## W = 0.70002, p-value = 7.294e-06
shapiro.test(A6Q4xlsx$Weight[A6Q4xlsx$Exercise == "lift"])
##
## Shapiro-Wilk normality test
##
## data: A6Q4xlsx$Weight[A6Q4xlsx$Exercise == "lift"]
## W = 0.78786, p-value = 0.0001436
#Group 1: nolift
#The first group is normally distributed, (p = 7.294e-06).
#Group 2: lift
#The second group is abnormally distributed, (p = .0.1436).