library(readxl)
library(rcompanion)
library(ggplot2)
library(readxl)
A4Q2 <- read_excel("C:/Users/winni/OneDrive - Saint Louis University/AA 5221/Assignment 4/A4Q2.xlsx")
View(A4Q2)
table(A4Q2$status, A4Q2$scholarship)
##                
##                   0   1
##   Domestic       39 111
##   International 118  32
scholarship_status <- table(A4Q2$scholarship, A4Q2$status)
scholarship_status
##    
##     Domestic International
##   0       39           118
##   1      111            32
barplot(scholarship_status,
beside = TRUE,
col = rainbow(nrow(scholarship_status)),
legend = rownames(scholarship_status))

chi_result <- chisq.test(scholarship_status)

chi_result
## 
##     Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  scholarship_status
## X-squared = 81.297, df = 1, p-value < 2.2e-16
rcompanion::cramerV(scholarship_status)
## Cramer V 
##   0.5272
# A Chi-Square Test of Independence was conducted to determine if there was an association between scholarship status and student nationality.

# The results showed that there was an association between the two variables, χ²(df) = 81.30, p < .001
# The association was large, (Cramer's V = .53).