library(readxl)
library(rcompanion)
library(ggplot2)
A4Q2 <- read_excel("C:/Assignment 4/A4Q2.xlsx")
enne_table <- table(A4Q2$status, A4Q2$scholarship)
observed <- enne_table
observed
##
## 0 1
## Domestic 39 111
## International 118 32
barplot(
enne_table,
beside = TRUE,
col = rainbow(nrow(enne_table)),
legend.text = rownames(enne_table))

chi_result <- chisq.test(enne_table)
chi_result
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: enne_table
## X-squared = 81.297, df = 1, p-value < 2.2e-16
rcompanion::cramerV(enne_table)
## Cramer V
## 0.5272
# A Chi-Square Test of Independence was conducted to determine
# whether there was an association between student status
# (Domestic vs. International) and scholarship award (0 vs. 1).
# The results showed that there was a difference between the
# observed and expected frequencies, χ²(1) = 81.30,
# p-value < 2.2e-16 which is 0.00000000000000022.
# The difference was large (Cramer's V = .53).