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)
# Import dataset
data <- read_excel("C:/Users/Admin/Downloads/Dataset6.1.xlsx")
# Check Data
head(data)
## # A tibble: 6 × 2
## Group Exam_Score
## <chr> <dbl>
## 1 Tutoring 73.5
## 2 Tutoring 76.2
## 3 Tutoring 90.5
## 4 Tutoring 78.6
## 5 Tutoring 79.0
## 6 Tutoring 91.7
str(data)
## tibble [80 × 2] (S3: tbl_df/tbl/data.frame)
## $ Group : chr [1:80] "Tutoring" "Tutoring" "Tutoring" "Tutoring" ...
## $ Exam_Score: num [1:80] 73.5 76.2 90.5 78.6 79 ...
library(dplyr)
# Calculate Descriptive Statistics for Each Group
data %>%
group_by(Group) %>%
summarise(
Mean = mean(Exam_Score, na.rm = TRUE),
Median = median(Exam_Score, na.rm = TRUE),
SD = sd(Exam_Score, na.rm = TRUE),
N = n()
)
## # A tibble: 2 × 5
## Group Mean Median SD N
## <chr> <dbl> <dbl> <dbl> <int>
## 1 No Tutoring 71.9 71.5 7.68 40
## 2 Tutoring 78.4 78.7 7.18 40
# Create Histograms for Each Group
hist(data$Exam_Score[data$Group=="Tutoring"],
main = "Histogram of Tutoring Scores",
xlab = "Exam Score",
ylab = "Frequency",
col = "Lightblue",
border = "Black",
breaks = 10)
hist(data$Exam_Score[data$Group=="No Tutoring"],
main = "Histogram of No Tutoring Scores",
xlab = "Exam Score",
ylab = "Frequency",
col = "lightgreen",
border = "Black",
breaks = 10)
# Boxplots
ggboxplot(data,
x = "Group",
y = "Exam_Score",
color = "Group",
add = "jitter")
The Tutoring boxplot appears normal. There are no dots past the whiskers. The No Tutoring boxplot appears mostly normal. Although there are a few points near the whiskers, there are no extreme outliers. We may proceed with the Independent t-test.
shapiro.test(data$Exam_Score[data$Group=="Tutoring"])
##
## Shapiro-Wilk normality test
##
## data: data$Exam_Score[data$Group == "Tutoring"]
## W = 0.98859, p-value = 0.953
shapiro.test(data$Exam_Score[data$Group=="No Tutoring"])
##
## Shapiro-Wilk normality test
##
## data: data$Exam_Score[data$Group == "No Tutoring"]
## W = 0.98791, p-value = 0.9398
Both test are normal will use independent t-test
t.test(Exam_Score ~ Group, data = data, var.equal = TRUE)
##
## Two Sample t-test
##
## data: Exam_Score by Group
## t = -3.8593, df = 78, p-value = 0.000233
## alternative hypothesis: true difference in means between group No Tutoring and group Tutoring is not equal to 0
## 95 percent confidence interval:
## -9.724543 -3.105845
## sample estimates:
## mean in group No Tutoring mean in group Tutoring
## 71.94627 78.36147
cohens_d(Exam_Score ~ Group, data = data)
Students in the Tutoring group (M = 78.36, SD = 7.18) scored significantly higher than students in the No Tutoring group (M = 71.94, SD = 7.68), t(78) = −3.86, p < .001. The effect size was large (Cohen’s d = 0.86).