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

chi_result <- chisq.test(student_data)
chi_result
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  student_data
## X-squared = 81.297, df = 1, p-value < 2.2e-16
rcompanion::cramerV(student_data)
## Cramer V 
##   0.5272
# A Chi-Square Test of Independence was conducted to determine if there was an association between status (of nationality, comparing domestic and international) and scholarship (yes or no).
# The results showed that there was an association between the two variables x2(1) = 81.30, p <.001.
# The association was large (Cramer's V = .53)