library(readxl)
A4Q2 <- read_excel("~/Library/CloudStorage/OneDrive-SaintLouisUniversity/AA-5221-12/Assignment 4/A4Q2/A4Q2.xlsx")
library(rcompanion)
library(ggplot2)
A4Q2_table <- table(A4Q2$scholarship, A4Q2$status)
A4Q2_table
##
## Domestic International
## 0 39 118
## 1 111 32
barplot(A4Q2_table,
beside = TRUE,
col = rainbow(nrow(A4Q2_table)),
legend = rownames(A4Q2_table))

chi_result <- chisq.test(A4Q2_table)
chi_result
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: A4Q2_table
## X-squared = 81.297, df = 1, p-value < 2.2e-16
rcompanion::cramerV(A4Q2_table)
## 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, χ²(1) = 81.297, p <.001.
# The association was strong, (Cramer's V = .53).