library(readxl)
library(rcompanion)
library(ggplot2)
A4Q2 <- read_excel("C:/Users/tmd97/Downloads/A4Q2.xlsx")
View(A4Q2)
scholarship_table <- table(A4Q2$status, A4Q2$scholarship)
scholarship_table
##
## 0 1
## Domestic 39 111
## International 118 32
barplot(scholarship_table,
beside = TRUE,
col = rainbow(nrow(scholarship_table)),
legend = rownames(scholarship_table))

chi_result <- chisq.test(scholarship_table)
chi_result
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: scholarship_table
## X-squared = 81.297, df = 1, p-value < 2.2e-16
rcompanion::cramerV(scholarship_table)
## 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.297, p < .001.
# The association was large, (Cramer's V = .53).
# I removed variable 1 and variable 2 and replaced it with status and scholarship because I previously overlooked it.
# I changed the p-value because I put the actual number not what we were told to put if the p-value was less than .001. So the correct answer is p < .001 because the p-value is less than .001.
# I changed the Cramer's V = to 53 because I did not round up my original answer. That is why I wrote 52 not 53.