library(readxl)
library(ggpubr)
## Loading required package: ggplot2
library(rcompanion)

Importing and naming the dataset

data1 <- read_excel("A5Q2.xlsx")

Create a Contingency Table

MyTable <- table(data1$nationality, data1$scholarship_awarded)

MyTable
##                
##                   0   1
##   Domestic       39 111
##   International 118  32

Create Bar Charts

barplot(MyTable, beside = TRUE,
        col = rainbow(nrow(MyTable)),
        legend = rownames(MyTable))

Conduct the Chi-Square Test of Independence

chisq.test(MyTable)
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  MyTable
## X-squared = 81.297, df = 1, p-value < 2.2e-16

Cramer’s V (Effect Size)

rcompanion::cramerV(MyTable)
## Cramer V 
##   0.5272

A Chi-Square Test of Independence was conducted to determine if there was an association between nationality and scholarship_awarded.

The results showed that there was an association between the two variables, χ²(1) = 81.29, p = <.001.

The association was strong, (Cramer’s V = .52).