library(readxl)
library(ggpubr)
## Loading required package: ggplot2
library(effectsize)

Research Question: Do the same participants have the same stress scores before versus after?

  1. Data Source
Dataset6.3<- read_excel("/Users/alexiaprudencio/Desktop/Applied Analytics 1/Assingment 6/Dataset6.3.xlsx")
  1. Data Separated by Condition
Before <- Dataset6.3$Stress_Pre
After <- Dataset6.3$Stress_Post

Differences <- After - Before
  1. Descriptive Statistics for Each Group
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
  1. Histogram of the Difference Scores
hist(Differences,
     main = "Histogram of Difference Scores",
     xlab = "Value",
     ylab = "Frequency",
     col = "lightblue",
     border = "darkblue",
     breaks = 20)

The histogram appears negatively skewed. The tail extends to the right with a higher concentration of frequent scores on the left side of the scale, betweem -15 and -5. The histogram kurtosis is tall. Most Individuals saw a decrease in their stress scores from before to after.

  1. Boxplot of the Difference Scores
boxplot(Differences,
        main = "Distribution of Score Differences (After - Before)",
        ylab = "Difference in Scores",
        col = "lightgreen",
        border = "darkgreen")

There are no outliers because there are no isolated dots floating above the top or bellow the bottoms whiskers. The data appears normal.

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

The p-value = 0.1745 > .05, which shows the distribution is normal and means we should proceed with a Dependent t-test.

  1. Inferential Test - 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

The p-value = 0.0003972 < .05, (less than .05), this means the results were significant and we should calculate the Effect Size.

  1. The Effect Size - Cohen’s D for Dependent T-Test
effectsize::cohens_d(After, Before, paired = TRUE)
## For paired samples, 'repeated_measures_d()' provides more options.
## Cohen's d |         95% CI
## --------------------------
## -0.66     | [-1.03, -0.29]
  1. Report the Results There was a significant difference in stress scores between the Before condition (M=65.87,SD=9.50) and the After condition (M=57.91,SD=10.17), t(34)=3.93,p=0.0003972. The effect size was between ± 0.50 to 1.00 (Cohen’s d=0.66), which means its very large.