Null Hypothesis (H0) There is no association between student nationality and scholarship status.
Alternative Hypothesis (H1) There is an association between student nationality and scholarship status.
#Load required libraries
library(readxl)
## Warning: package 'readxl' was built under R version 4.6.1
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.6.1
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.6.1
library(rcompanion)
## Warning: package 'rcompanion' was built under R version 4.6.1
#Read dataset
Q2 <- read_excel("A5Q2.xlsx")
#Create contingency table
Table <- table(Q2$nationality, Q2$scholarship_awarded)
print(Table)
##
## 0 1
## Domestic 39 111
## International 118 32
#Create grouped bar chart
barplot(Table,
beside = TRUE,
col = rainbow(nrow(Table)),
legend = rownames(Table),
main = "Nationality and Scholarship Awarded",
xlab = "Scholarship (0 = No, 1 = Yes)",
ylab = "Count")
#Conduct Chi-Square Test of Independence
chi_result <- chisq.test(Table)
print(chi_result)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: Table
## X-squared = 81.297, df = 1, p-value < 2.2e-16
# Calculate effect size (Cramer's V)
effect_size <- rcompanion::cramerV(Table)
print(effect_size)
## Cramer V
## 0.5272
A Chi-Square Test of Independence was conducted to determine if there was an association between student nationality (domestic versus international) and whether or not the student got a scholarship. There was a significant association between the two variables, chi^2(1) = 81.30, p < .001. The association was strong (Cramer’s V = .53).