Open the Installed 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)
Dataset6.2 <- read_excel("C:/Users/tejas/Downloads/Dataset6.2.xlsx")

Calculate 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

Created Histograms for Each Group

hist(Dataset6.2$Study_Hours[Dataset6.2$Work_Status == "Works"],
     main = "Histogram of Works Hours",
     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 Hours",
     xlab = "Value",
     ylab = "Frequency",
     col = "lightgreen",
     border = "black",
     breaks = 10)

For the Work histogram, the data appears positively skewed. It is difficult to state the exact kurtosis, but it appears abnormal.

For the Does_Not_Work histogram, the data appears positively skewed. It is difficult to state the exact kurtosis, but it appears abnormal.

We may need to use Mann-Whitney U test.

Created Boxplots for Each Group

ggboxplot(Dataset6.2, x = "Work_Status", y = "Study_Hours",
          color = "Work_Status",
          palette = "jco",
          add = "jitter")

Output Interpretation

The Works boxplot appears normal. There are no dots past the whiskers. The Does_Not_Work boxplot appears abnormal. There are 2 outliers. We may use Mann-Whitney U test.

Shapiro-Wilk Test of Normality

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

Output Interpretation

The data for Works is not normal (0.1305). The data for Does_Not_Work is normal (0.0003695). After conducting all three normality tests, it is clear we must use a Mann-Whitney U test.

Mann-Whitney U Test

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-value is greater than 0.05 this means the results were NOT significant.

Results

Works (Mdn = 5.64) was not significantly different from Does_Not_Work (Mdn = 8.54) in Study Hours, U = 569, p = 0.07973.