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

chi_result <- chisq.test(scholarships)

chi_result
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  scholarships
## X-squared = 81.297, df = 1, p-value < 2.2e-16
rcompanion::cramerV(scholarships) 
## Cramer V 
##   0.5272
# A Chi-Square Test of Independence was conducted to determine if there was an association between Status and scholarship
# The results showed that there was an association between the two variables, χ²(1) =81.30  p = <.001
# The association was large (Cramer V = 0.53)
#I removed the extra numbers that didnt belong to the results.
#I commented correctly on the Chi-Square test of independence.