Installing Required Packages install.packages(“readxl”) install.packages(“ggpubr”) install.packages(“dplyr”) install.packages(“effectsize”) install.packages(“effsize”)
Loading required Packages:
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)
Loading Dataset:
Dataset6.2 <- read_excel("C:/Users/datta/Downloads/Dataset6.2-2.xlsx")
Calculating Descriptive Statistics for Each Group:
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
Creating Histograms for Each Group:
hist(Dataset6.2$Study_Hours[Dataset6.2$Work_Status == "Does_Not_Work"],
main = "Histogram of Study Hours (Does Not Work)",
xlab = "Study Hours",
ylab = "Frequency",
col = "lightblue",
border = "black",
breaks = 10)
hist(Dataset6.2$Study_Hours[Dataset6.2$Work_Status == "Works"],
main = "Histogram of Study Hours (Works)",
xlab = "Study Hours",
ylab = "Frequency",
col = "lightgreen",
border = "black",
breaks = 10)
Creating Boxplots for Each Group:
ggboxplot(Dataset6.2, x = "Work_Status", y = "Study_Hours",
color = "Work_Status",
palette = "jco",
add = "jitter")
Shapiro-Wilk Test of Normality:
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
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
The p-value for not working group is less than .05,the data is abnormal.The working group’s p-value is greater than.05, indicating that the data is normal. Therefore, we must continue using the Mann-Whitney U test in order to do the inferential test.
Conducting Inferential Test : Mann-Whitney U
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
The results are not significant because the p-value is more than.05. The effect size does not need to be determined.
Reporting the Results: Study hours for the group that Does Not Work (Mdn = 8.54) were not significantly different from the group that Works (Mdn = 5.64), U = 569, p = 0.07973(>.05).
The effect size was not calculated as the result was not significant.