Is there an association between student nationality (domestic versus
international)and whether or not they have a scholarship (yes versus
no)?
Open the Required Packages
library(readxl)
## Warning: package 'readxl' was built under R version 4.6.1
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.6.1
library(rcompanion)
## Warning: package 'rcompanion' was built under R version 4.6.1
library(rmarkdown)
# I added the rmarkdown on my script to match the answer key
Import & Name Dataset
A5Q2 <-read_excel("C:/Users/rteno/OneDrive - Saint Louis University/AA 5221/Assignment 5/Question 2/A5Q2.xlsx")
Create a Contingency Table
MyTable <- table(A5Q2$nationality,
A5Q2$scholarship_awarded)
MyTable
##
## 0 1
## Domestic 39 111
## International 118 32
Create a bar chart
barplot(
MyTable,
beside = TRUE,
col = rainbow(nrow(MyTable)),
legend = rownames(MyTable),
main = "Nationality and Scholarship Awarded",
xlab = "No or Yes",
ylab = "Count")

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
Interpret and Report the Results
# A Chi-Square Test of Independence was conducted to determine if there was an association between student nationality and whether or not they had a scholarship.
# The results showed that there was an association between the two variables, χ²(1) = 81.30, p < .001.
# The association was strong,(Cramer's V = .53).