Research Scenario 6.2: Work Status and Study Hours

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("/Users/asfia/Desktop/Dataset6.2.xlsx")

Checking Data and Dataset Structure

head(Dataset6.2)
## # 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(Dataset6.2)
## 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 ...

Calculate descriptive statistics for each group

Dataset6.2 %>%
  group_by(Work_Status) %>%
  summarise(
    Mean = mean(Study_Hours),
    Median = median(Study_Hours),
    SD = sd(Study_Hours),
    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

Check normality

Method 1: Histograms

hist(Dataset6.2$Study_Hours[Dataset6.2$Work_Status == "Does_Not_Work"],
     main = "Histogram of Study Hours - Non-Working Students",
     xlab = "Study Hours per Week",
     ylab = "Frequency",
     col = "lightgreen",
     border = "darkgreen",
     breaks = 10)

#### Skewness: Positively Skewed ,“,”Kurtosis: It is difficult to state the exact kurtosis, but it appears abnormal

hist(Dataset6.2$Study_Hours[Dataset6.2$Work_Status == "Works"],
     main = "Histogram of Study Hours - Working Students",
     xlab = "Study Hours per Week",
     ylab = "Frequency",
     col = "lightblue",
     border = "blue",
     breaks = 10)

#### Skewness: Positively Skewed ,“,”Kurtosis: It is difficult to state the exact kurtosis, but it appears abnormal

For Working group: the data looks Positively Skewed, and the kurtosis looks abnormal and For Non-Working group: the data looks Positively Skewed, and the kurtosis looks abnormal. So based on the reports weuse the Mann-Whitney U test

Method 2: Boxplots

ggboxplot(Dataset6.2, x = "Work_Status", y = "Study_Hours",
          color = "Work_Status",
          palette = c("blue", "green"),
          add = "jitter",
          title = "Study Hours by Work Status",
          xlab = "Work Status",
          ylab = "Study Hours per Week")

#### For Working group: the data looks somewhat normal with only one outlier and For Non-Working group: the data looks abnormal with multiple outliers and unevely distributed so Based on Reports we use the Mann-Whitney U test.

Method 3: Shapiro-Wilk

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

For Working group: the value of p > 0.05, so the data is normal and For Non-Working group: the value of p < 0.05 (0.0003695), so the data is not normal. So, Based on Reports we use the Mann-Whitney U test

Interpretation: After conducting all three normality tests, it is clear that we must use a Mann-Whitney U test.

Conduct Inferential 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

As the value of p > 0.05 (p = 0.07973), this indiactes the results were NOT significant. So we’ll skip effect size.

Report the Results: 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