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
Dataset6.3 <- read_excel("C:/Users/elapr/Downloads/Dataset6.3.xlsx")
Before <- Dataset6.3$Stress_Pre
After <- Dataset6.3$Stress_Post
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 Difference stress",
xlab = "Value",
ylab = "Frequency",
col = "blue",
border = "black",
breaks = 20)
The Graph looks slightly flat and slightly bell shape.
boxplot(Differences,
main = "Distribution of Stress Differences (After - Before)",
ylab = "Difference in Stress",
col = "blue",
border = "darkblue")
There is no outlier in this boxplot.
shapiro.test(Differences)
##
## Shapiro-Wilk normality test
##
## data: Differences
## W = 0.95612, p-value = 0.1745
p > .05 (0.175), the data was NORMAL. Continuing with Dependent 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
p-value = 0.00039, which is less than 0.05 which means the difference between pre & post stresscscores is significant. Since the data is significant, we will be calculating the effective size using Cohen’s D test.
effectsize::cohens_d(Before,After, paired = TRUE)
## For paired samples, 'repeated_measures_d()' provides more options.
## Cohen's d | 95% CI
## ------------------------
## 0.66 | [0.29, 1.03]
There was a significant difference in Pre Stress (median = 67.33, SD = 9.49) and Post Stress (Median = 59.14, SD = 10.1712), t = 3.92, p < .001.(0.000392) The effect size was medium (Cohen’s d = .66).