library(ggplot2)
library(rcompanion)
library(readxl)
library(ggpubr)
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)
##
## Attaching package: 'effectsize'
## The following object is masked from 'package:rcompanion':
##
## phi
library(effsize)
Dataset6_2 <- read_excel("C:/Users/user/Downloads/Dataset6.2.xlsx")
Dataset6_2 %>%
group_by(Work_Status)%>%
summarise(
Mean = mean(Study_Hours, na.rm = TRUE),
Median = median(Study_Hours, na.rm = TRUE),
SD = sd(Study_Hours, na.rm = TRUE),
N = n()
)
## # A tibble: 2 × 5
## Work_Status Mean Median SD N
## <chr> <dbl> <dbl> <dbl> <int>
## 1 Does_Not_Work 9.62 8.54 7.45 30
## 2 Works 6.41 5.64 4.41 30
# Histograms for Each Group
hist(Dataset6_2$Study_Hours[Dataset6_2$Work_Status == "Works"],
main = "Histogram of works",
xlab = "value",
ylab = "Frequency",
col = "lightblue",
border = "black",
breaks = 10)

hist(Dataset6_2$Study_Hours[Dataset6_2$Work_Status == "Does_Not_Work"],
main = "Histogram of Does_Not_Work",
xlab = "value",
ylab = "Frequency",
col = "lightgreen",
border = "black",
breaks = 10)

#For the Does_Not_Work histogram, the data appears negatively skewed.
#It is difficult to state the exact kurtosis, but it appears abnormal.
#For the works histogram, the data appears symmetrical (normal).
#The kurtosis also appears bell-shaped (normal).
ggboxplot(Dataset6_2, x = "Work_Status", y = "Study_Hours",
color = "Work_Status",
palette = "jco",
add = "jitter")

#the work boxplot appears normal. There are no dots past the whiskers.
#The does not work boxplot appears abnormal.
#There are several dots past the whiskers.
#Although some are very close to the whiskers, some are arguably far away.
shapiro.test(Dataset6_2$Study_Hours[Dataset6_2$Work_Status == "Works"])
##
## Shapiro-Wilk normality test
##
## data: Dataset6_2$Study_Hours[Dataset6_2$Work_Status == "Works"]
## W = 0.94582, p-value = 0.1305
shapiro.test(Dataset6_2$Study_Hours[Dataset6_2$Work_Status == "Does_Not_Work"])
##
## Shapiro-Wilk normality test
##
## data: Dataset6_2$Study_Hours[Dataset6_2$Work_Status == "Does_Not_Work"]
## W = 0.83909, p-value = 0.0003695
# p < .05 (less than .05), the data was NOT normal.
wilcox.test(Study_Hours ~ Work_Status, data = Dataset6_2)
##
## Wilcoxon rank sum exact test
##
## data: Study_Hours by Work_Status
## W = 569, p-value = 0.07973
## alternative hypothesis: true location shift is not equal to 0
# p > .05 (greater than .05), this means the results were NOT significant
#student who do not work ((Mdn = 8.54) was not significantly different from student who work (Mdn = 5.64), U =569, p = .080.
# No effect size .