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
cannonboy <- read_excel("D:/Vedant Work/SLU/Spring Sem (Jan to May 2026)/Applied Analytics/Assignment 6/Assignment 6.3/cannonboy.xlsx")
names(cannonboy)
## [1] "studentid"  "stresspre"  "stresspost"
Before <- cannonboy$stresspre
After  <- cannonboy$stresspost
Differences <- After - Before
mean(Before, na.rm = TRUE)
## [1] 65.86954
median(Before, na.rm = TRUE)
## [1] 67.33135
sd(Before, na.rm = TRUE)
## [1] 9.496524
mean(After, na.rm = TRUE)
## [1] 57.90782
median(After, na.rm = TRUE)
## [1] 59.14539
sd(After, na.rm = TRUE)
## [1] 10.1712
hist(Differences,
     main = "Histogram of Stress Score Differences",
     xlab = "After - Before",
     ylab = "Frequency",
     col = "skyblue",
     border = "black",
     breaks = 20)

boxplot(Differences,
        main = "Distribution of Stress Score Differences (After - Before)",
        ylab = "Difference in Stress Scores",
        col = "lightgreen",
        border = "navyblue")

shapiro.test(Differences)
## 
##  Shapiro-Wilk normality test
## 
## data:  Differences
## W = 0.95612, p-value = 0.1745
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

There was a significant difference in stress levels before the mindfulness program (M = 65.87, SD = 9.50) and after the program (M = 57.91, SD = 10.17), t(34) = 3.93, p < .001.

Stress levels significantly decreased following participation in the four-week mindfulness training program.