library(readxl)

# Import data
A4Q2 <- read_excel("C:/Users/eboni/Downloads/A4Q2.xlsx")

# Create frequency table
observed <- table(A4Q2$status, A4Q2$scholarship)
observed
##                
##                   0   1
##   Domestic       39 111
##   International 118  32
# Create bar chart
barplot(observed,
        beside = TRUE,
        main = "Scholarship Status by Student Status",
        xlab = "Scholarship Status",
        ylab = "Count",
        names.arg = c("No Scholarship", "Scholarship"),
        legend.text = c("Domestic", "International"))

# Chi-Square Test of Independence
chi_result <- chisq.test(observed)
chi_result
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  observed
## X-squared = 81.297, df = 1, p-value < 2.2e-16
# Cramer's V
cramers_v <- sqrt(as.numeric(chi_result$statistic) / sum(observed))
cramers_v
## [1] 0.5205671

Interpretation

A Chi-Square Test of Independence was conducted to determine if there was an association between student status and scholarship status.

The results showed that there was a significant association between the two variables, χ²(1) = 81.30, p < .001.

The association was large, Cramer’s V = .52. ```