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)
data <- read_excel("C:/Users/Admin/Downloads/Dataset6.2-2.xlsx")
head(data)
## # A tibble: 6 × 2
## Work_Status Study_Hours
## <chr> <dbl>
## 1 Works 3.57
## 2 Works 13.2
## 3 Works 0.577
## 4 Works 6.65
## 5 Works 17.3
## 6 Works 8.47
str(data)
## tibble [60 × 2] (S3: tbl_df/tbl/data.frame)
## $ Work_Status: chr [1:60] "Works" "Works" "Works" "Works" ...
## $ Study_Hours: num [1:60] 3.568 13.247 0.577 6.65 17.344 ...
data %>%
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
hist(data$Study_Hours[data$Work_Status=="Works"],
main = "Histogram of Study Hours (Works)",
xlab = "Study Hours",
ylab = "Frequency",
col = "lightblue",
border = "black",
breaks = 10)
The histogram for the Works group appears moderately symmetric with no extreme skew. The distribution does not show clear deviations from normality.
hist(data$Study_Hours[data$Work_Status=="Does_Not_Work"],
main = "Histogram of Study Hours (Does Not Work)",
xlab = "Study Hours",
ylab = "Frequency",
col = "lightgreen",
border = "black",
breaks = 10)
The histogram for the Does_Not_Work group appears visibly skewed with
several values extending further on one side, suggesting the data may
not be normally distributed.
ggboxplot(data,
x = "Work_Status",
y = "Study_Hours",
color = "Work_Status",
add = "jitter")
The Works boxplot appears mostly normal. There are no extreme outliers
beyond the whiskers. The Does_Not_Work boxplot appears less symmetric,
with greater spread and some points further from the central
distribution, suggesting potential non-normality.
shapiro.test(data$Study_Hours[data$Work_Status=="Works"])
##
## Shapiro-Wilk normality test
##
## data: data$Study_Hours[data$Work_Status == "Works"]
## W = 0.94582, p-value = 0.1305
shapiro.test(data$Study_Hours[data$Work_Status=="Does_Not_Work"])
##
## Shapiro-Wilk normality test
##
## data: data$Study_Hours[data$Work_Status == "Does_Not_Work"]
## W = 0.83909, p-value = 0.0003695
The Shapiro–Wilk test for the Works group was not significant (p > .05). This means the data is normally distributed. The Shapiro–Wilk test for the Does_Not_Work group was significant (p < .05). This means the data is not normally distributed.Since one group is not normal, we cannot use the independent t-test.
wilcox.test(Study_Hours ~ Work_Status, data = data)
##
## 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
The Mann–Whitney U test was not statistically significant (p > .05).This means there is no significant difference in Study Hours between students who work and students who do not work.
Working Students Group ((Mdn = 5.64) was not significantly different from Non-Working Students Group (Mdn = 8.54), U = 569, p = .07973. The data wasn’t Statically Significant