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)
fourarms<-read_excel("D:/Vedant Work/SLU/Spring Sem (Jan to May 2026)/Applied Analytics/Assignment 6/Assignment 6.1/fourarms.xlsx")
fourarms%>%
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
hist(fourarms$Exam_Score[fourarms$Group=="Tutoring"],
main="Historgram of Tutored student scores",
xlab="Exam Score",
ylab="Frequency",
col="lightblue",
border="black",
breaks=10)
hist(fourarms$Exam_Score[fourarms$Group=="No Tutoring"],
main="Histogram of not tutored student scores",
xlab="Exam Score",
ylab="Frequency",
col="lightgreen",
border="black",
breaks=10)
ggboxplot(fourarms, x = "Group", y = "Exam_Score",
color = "Group",
palette = "jco",
add = "jitter",
title = "Boxplot of Exam Scores by Group")
Step 7: Conduct Independent T-Test
t_test_result <- t.test(Exam_Score ~ Group,
data = fourarms,
var.equal = TRUE) # assumes equal variances
t_test_result
##
## 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
Step 8: Calculate Effect Size (Cohen’s D) for Independent T-Test Only run if t-test was significant (p < 0.05)
cohens_d_result <- cohens_d(Exam_Score ~ Group,
data = fourarms,
pooled_sd = TRUE)
Print the Cohen’s d result
print(cohens_d_result)
## Cohen's d | 95% CI
## --------------------------
## -0.86 | [-1.32, -0.40]
##
## - Estimated using pooled SD.
Students who did not attend tutoring (Nottutored; M = 71.95, SD = 7.XX) were significantly different from students who attended tutoring (Tutored; M = 78.36, SD = 7.XX) in exam scores, t(78) = −3.86, p < .001. The effect size was large (Cohen’s d = 0.86).