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
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
Dataset6.3 <- read_excel("/Users/komakechivan/Downloads/Dataset6.3.xlsx")
Before <- Dataset6.3$Stress_Pre
After <- Dataset6.3$Stress_Post
Differences <- After - Before
mean_pre <- mean(Before, na.rm = TRUE); sd_pre <- sd(Before, na.rm = TRUE)
mean_post <- mean(After, na.rm = TRUE); sd_post <- sd(After, na.rm = TRUE)
df_long <- data.frame(
id = rep(1:length(Before), 2),
time = factor(rep(c("Before", "After"), each = length(Before)), levels = c("Before", "After")),
score = c(Before, After)
)
hist(Differences, main = "Histogram of Difference Scores", col = "blue", border = "black")
boxplot(Differences, main = "Boxplot of Difference Scores (After - Before)", col = "blue")
shapiro.test(Differences)
##
## Shapiro-Wilk normality test
##
## data: Differences
## W = 0.95612, p-value = 0.1745
t_result <- t.test(Before, After, paired = TRUE)
print(t_result)
##
## 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
eff_size <- cohens_d(score ~ time, data = df_long, paired = TRUE)
print(eff_size)
## # A tibble: 1 × 7
## .y. group1 group2 effsize n1 n2 magnitude
## * <chr> <chr> <chr> <dbl> <int> <int> <ord>
## 1 score Before After 0.664 35 35 moderate
The average stress score decreased following the completion of the mindfulness training program.
Normality was assessed by conducting a Shapiro-Wilk test on the difference scores (Post-test minus Pre-test) between the two conditions.
A paired t-test revealed a statistically significant reduction in stress levels following the mindfulness program:
Since the results were significant, the effect size was calculated to determine the magnitude of the change. The effect size was found to be moderate to large (Cohen’s \(d = 0.66\)).
We reject the null hypothesis. There is strong statistical evidence to suggest that the four-week mindfulness training program significantly reduced student stress levels.