This analysis is for RESEARCH SCENARIO 3 from assignment 6. It tests to compare Communication Skills Score before and after taking a training.
A dependent t-test was conducted to compare Communication Skills Score before and after having a defensive driving course among 150 participants. Results showed that post-training Skills Scores (M = 69.24, SD = 9.48) were significantly higher than pre-course scores (M = 59.73, SD = 7.97), t(149) = -23.285, p < .001. The effect size was Cohen’s d = -1.90, indicating a large effect. These results suggest that the training significantly enhanced Communication Skills.
IMPORT EXCEL FILE Import your Excel dataset into R to conduct analyses.
# INSTALL REQUIRED PACKAGE
# install.packages("readxl")
# LOAD THE PACKAGE
library(readxl)
# IMPORT EXCEL FILE INTO R STUDIO
dataset <- read_excel("//apporto.com/dfs/SLU/Users/minhoku_slu/Downloads/A6R3.xlsx")
CALCULATE THE DIFFERENCE SCORES Purpose: Calculate the difference between the Before scores versus the after scores.
# RENAME THE VARIABLES
Before <- dataset$PreTraining
After <- dataset$PostTraining
Differences <- After - Before
HISTOGRAM Create a histogram for difference scores to visually check skewness and kurtosis.
# CREATE THE HISTOGRAMS
hist(Differences,
main = "Histogram of Difference Scores",
xlab = "Value",
ylab = "Frequency",
col = "blue",
border = "black",
breaks = 20)
QUESTION 1: Is the histograms symmetrical, positively skewed, or negatively skewed?
ANSWER: The histogram is negatively skewed.
QUESTION 2: Did the histogram look too flat, too tall, or did it have a proper bell curve?
ANSWER: The histogram have a proper bell curve
SHAPIRO-WILK TEST Check the normality for the difference between the groups.
shapiro.test(Differences)
##
## Shapiro-Wilk normality test
##
## data: Differences
## W = 0.98773, p-value = 0.21
QUESTION 1: Was the data normally distributed or abnormally distributed?
ANSWER:The data was normally distributed.
BOXPLOT Check for any outliers impacting the mean.
boxplot(Differences,
main = "Distribution of Score Differences (After - Before)",
ylab = "Difference in Scores",
col = "blue",
border = "darkblue")
QUESTION 1: How many dots are in your boxplot?
QUESTION 2: Where are the dots in your boxplot?
ANSWER:B
QUESTION 3: Based on the dots and there location, is the data normal?
ANSWER: The data is normal.
DESCRIPTIVE STATISTICS Calculate the mean, median, SD, and sample size for each group.
# DESCRIPTIVES FOR BEFORE SCORES
mean(Before, na.rm = TRUE)
## [1] 59.73333
median(Before, na.rm = TRUE)
## [1] 60
sd(Before, na.rm = TRUE)
## [1] 7.966091
length(Before)
## [1] 150
# DESCRIPTIVES FOR AFTER SCORES
mean(After, na.rm = TRUE)
## [1] 69.24
median(After, na.rm = TRUE)
## [1] 69.5
sd(After, na.rm = TRUE)
## [1] 9.481653
length(After)
## [1] 150
Note: The Dependent t-test is also called the Paired Samples t-test.
t.test(Before, After, paired = TRUE)
##
## Paired t-test
##
## data: Before and After
## t = -23.285, df = 149, p-value < 2.2e-16
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## -10.313424 -8.699909
## sample estimates:
## mean difference
## -9.506667
DETERMINE STATISTICAL SIGNIFICANCE * p< 0.001
EFFECT SIZE FOR DEPENDENT T-TEST Purpose: Determine how big of a difference there was between the group means.
# INSTALL REQUIRED PACKAGE
# install.packages("effectsize")
# LOAD THE PACKAGE
library(effectsize)
# CALCULATE COHEN’S D
cohens_d(Before, After, paired = TRUE)
## For paired samples, 'repeated_measures_d()' provides more options.
## Cohen's d | 95% CI
## --------------------------
## -1.90 | [-2.17, -1.63]
QUESTIONS
QUESTION 1: What is the size of the effect?
YOUR ANSWER: A Cohen’s D of -1.90 indicates the difference between the group averages was very large.
QUESTION 2: Which group had the higher average score?
YOUR ANSWER: After group has higher score.