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

Before <- data$Stress_Pre
After  <- data$Stress_Post

Differences <- After - Before

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(Before, After, paired = TRUE)
## 
##  Paired t-test
## 
## data:  Before and After
## 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

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 = 66).