Load Libraries

library(readxl)
library(ggpubr)
## Loading required package: ggplot2
library(effectsize)
library(rstatix)
## 
## Attaching package: 'rstatix'
## The following objects are masked from 'package:effectsize':
## 
##     cohens_d, eta_squared
## The following object is masked from 'package:stats':
## 
##     filter

Import Dataset

data <- read_excel("C:/Users/Admin/Downloads/Dataset6.3.xlsx")

Check Data

head(data)
## # A tibble: 6 × 3
##   Student_ID Stress_Pre Stress_Post
##        <dbl>      <dbl>       <dbl>
## 1          1       82.0        59.1
## 2          2       57.9        35.7
## 3          3       62.2        74.4
## 4          4       63.8        56.4
## 5          5       63.8        58.3
## 6          6       67.7        42.6
str(data)
## tibble [35 × 3] (S3: tbl_df/tbl/data.frame)
##  $ Student_ID : num [1:35] 1 2 3 4 5 6 7 8 9 10 ...
##  $ Stress_Pre : num [1:35] 82 57.9 62.2 63.8 63.8 ...
##  $ Stress_Post: num [1:35] 59.1 35.7 74.4 56.4 58.3 ...

Create Variables

Pre_Test  <- data$Stress_Pre
Post_Test <- data$Stress_Post

Differences <- Post_Test - Pre_Test

DESCRIPTIVE STATISTICS

mean(Pre_Test, na.rm = TRUE)
## [1] 65.86954
median(Pre_Test, na.rm = TRUE)
## [1] 67.33135
sd(Pre_Test, na.rm = TRUE)
## [1] 9.496524
mean(Post_Test, na.rm = TRUE)
## [1] 57.90782
median(Post_Test, na.rm = TRUE)
## [1] 59.14539
sd(Post_Test, na.rm = TRUE)
## [1] 10.1712

Histogram of Difference Scores

hist(Differences,
     main = "Histogram of Difference Scores",
     xlab = "Difference (Post - Pre)",
     col = "lightblue",
     border = "black",
     breaks = 10)

Histogram Interpretation

The histogram shows the distribution of the difference scores.The bars appear reasonably symmetric with no extreme skewness. Most values are clustered near the center, and there are no unusual gaps or extreme values.This suggests that the difference scores appear approximately normally distributed.

Boxplot of Differences

boxplot(Differences,
        main = "Boxplot of Differences",
        col = "lightgreen",
        border = "black")

Boxplot Interpretation

The boxplot displays the spread of the difference scores.There are no extreme outliers far beyond the whiskers. The data points appear reasonably balanced.This supports the assumption that the difference scores do not contain problematic outliers.

Shapiro–Wilk Normality Test

shapiro.test(Differences)
## 
##  Shapiro-Wilk normality test
## 
## data:  Differences
## W = 0.95612, p-value = 0.1745

Normality Test Interpretation

The Shapiro–Wilk test was not significant (p > .05).This means the difference scores do not significantly deviate from normality.Therefore, the normality assumption is satisfied.

Paired Samples t-Test

t.test(Pre_Test, Post_Test, paired = TRUE)
## 
##  Paired t-test
## 
## data:  Pre_Test and Post_Test
## t = 3.9286, df = 34, p-value = 0.0003972
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
##   3.843113 12.080317
## sample estimates:
## mean difference 
##        7.961715

Effect size

cohens_d <- effectsize::cohens_d(Pre_Test, Post_Test, paired = TRUE)
## For paired samples, 'repeated_measures_d()' provides more options.
print(cohens_d)
## Cohen's d |       95% CI
## ------------------------
## 0.66      | [0.29, 1.03]

Interpretation

There was a significant difference in stress between Pre-Stress Group (M = 65.86, SD = 9.49) and Post-Stress Group (M = 57.90, SD = 10.17), t(34) = 3.92, p < .0003972 The effect size was Medium (Cohen’s d = 0.66).