This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(readxl)
library(ggpubr)
## Loading required package: ggplot2
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
library(effectsize)
library(effsize)
Dataset6.4 <- read_excel("C:/Users/tanie/Downloads/Dataset6.4.xlsx")
Before <- Dataset6.4$Stress_Pre
After <- Dataset6.4$Stress_Post
Differences <- After - Before
mean(Before, na.rm = TRUE)
## [1] 51.53601
median(Before, na.rm = TRUE)
## [1] 47.24008
sd(Before, na.rm = TRUE)
## [1] 17.21906
mean(After, na.rm = TRUE)
## [1] 41.4913
median(After, na.rm = TRUE)
## [1] 40.84836
sd(After, na.rm = TRUE)
## [1] 18.88901
hist(Differences,
main = "Histogram of Difference Scores",
xlab = "Value",
ylab = "Frequency",
col = "blue",
border = "black",
breaks = 20)
The histogram is negatively skewed and is not normal
boxplot(Differences,
main = "Distribution of Score Differences (After - Before)",
ylab = "Difference in Scores",
col = "blue",
border = "darkblue")
There are outliers far away from the whiskers . the data is not normal
shapiro.test(Differences)
##
## Shapiro-Wilk normality test
##
## data: Differences
## W = 0.87495, p-value = 0.0008963
p-value is less than.05, the data in not normal we should proceed with Wilcoxon sign rank
wilcox.test(Before, After, paired = TRUE)
##
## Wilcoxon signed rank exact test
##
## data: Before and After
## V = 620, p-value = 2.503e-09
## alternative hypothesis: true location shift is not equal to 0
There was no significant difference in stress levels between Stress_Pre (Mdn = 47.24) and Stress_Post (Mdn = 40.85), V = 620, p = 2.5.