Dataset6.2 <- read_excel("C:/Users/Student/Documents/Assignment6_AA/Dataset6.2.xlsx")
Dataset6.2 %>%
  group_by(Work_Status) %>%
  summarise(
    Mean = mean(Study_Hours, na.rm = TRUE),
    SD = sd(Study_Hours, na.rm = TRUE),
    Median = median(Study_Hours, na.rm = TRUE)
  )
## # A tibble: 2 × 4
##   Work_Status    Mean    SD Median
##   <chr>         <dbl> <dbl>  <dbl>
## 1 Does_Not_Work  9.62  7.45   8.54
## 2 Works          6.41  4.41   5.64

Histogram

hist(Dataset6.2$Study_Hours,
     main = "Histogram of Study Hours",
     xlab = "Study Hours")

#Normality

Dataset6.2 %>%
  group_by(Work_Status) %>%
  shapiro_test(Study_Hours)
## # A tibble: 2 × 4
##   Work_Status   variable    statistic        p
##   <chr>         <chr>           <dbl>    <dbl>
## 1 Does_Not_Work Study_Hours     0.839 0.000369
## 2 Works         Study_Hours     0.946 0.131

Boxplot for Normality Check

ggboxplot(Dataset6.2,
          x = "Work_Status",
          y = "Study_Hours",
          color = "Work_Status",
          palette = "jco",
          add = "jitter",
          main = "Boxplot of Study Hours by Work Status")

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

Effect Size

wilcox_effsize(Dataset6.2,
               Study_Hours ~ Work_Status)
## # A tibble: 1 × 7
##   .y.         group1        group2 effsize    n1    n2 magnitude
## * <chr>       <chr>         <chr>    <dbl> <int> <int> <ord>    
## 1 Study_Hours Does_Not_Work Works    0.227    30    30 small

#reporting thr result

cat("Students who do not work (Mdn = 8.54) were not 
    significantly different from students who work (Mdn = 5.64)
    in study hours, U = 569, p > .05.")
## Students who do not work (Mdn = 8.54) were not 
##     significantly different from students who work (Mdn = 5.64)
##     in study hours, U = 569, p > .05.