library("readxl")
library("ggplot2")
library("rcompanion")
A4Q2 <- read_excel("C:/Users/siqoe/OneDrive - Saint Louis University/AA 5221/Assignment 4/A4Q2.xlsx")
View(A4Q2)
(A4Q2)
## # A tibble: 300 × 3
##       ID status   scholarship
##    <dbl> <chr>          <dbl>
##  1     1 Domestic           1
##  2     2 Domestic           0
##  3     3 Domestic           1
##  4     4 Domestic           0
##  5     5 Domestic           0
##  6     6 Domestic           1
##  7     7 Domestic           1
##  8     8 Domestic           0
##  9     9 Domestic           1
## 10    10 Domestic           1
## # ℹ 290 more rows
MyTable<-table(A4Q2$scholarship,A4Q2$status)
MyTable
##    
##     Domestic International
##   0       39           118
##   1      111            32
barplot(MyTable, 
        beside = TRUE,
        col = rainbow(nrow(MyTable)),
        legend = rownames(MyTable))

chi_result <- chisq.test(MyTable) 
chi_result
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  MyTable
## X-squared = 81.297, df = 1, p-value < 2.2e-16
rcompanion::cramerV(MyTable)
## Cramer V 
##   0.5272
# A Chi-Square Test of Independence was conducted to determine if there was an association between scholarship allocation  and status.
# The results showed that there was an association between the two variables, χ²(1) = 81.297, p = <.001.
# The association was strong, (Cramer's V = .5272).