Is there an association between student nationality (domestic versus international) and whether or not they have a scholarship (yes versus no)?
library(readxl)
library(rcompanion)
library(ggplot2)
A4Q2 <- read_excel("C:/Users/DeSheila Hatcher/OneDrive/Desktop/Assignment 4/A4Q2.xlsx.xlsx")
observed <- table(A4Q2$status, A4Q2$scholarship)
observed
##
## 0 1
## Domestic 39 111
## International 118 32
barplot(observed,
beside = TRUE,
col = rainbow(nrow(observed)),
legend = rownames(observed),
main = "Nationality and Scholarship Awarded",
xlab = "No or Yes",
ylab = "Count")
chi_result <- chisq.test(observed)
chi_result
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: observed
## X-squared = 81.297, df = 1, p-value < 2.2e-16
cramer_v <- rcompanion::cramerV(observed)
cramer_v
## Cramer V
## 0.5272
# Correction for Question 2:
# My chi-square test, effect size, and interpretation were correct.
# I updated the bar chart to include the title and axis labels shown in the answer key.
# I added a chart title, an x-axis label, and a y-axis label.
A Chi-Square Test of Independence was conducted to determine if there was an association between student nationality (domestic or international) and scholarship status (yes or no).
The results showed that there was an association between the two variables, χ²(1) = 81.30, p < .001.
The association was large (Cramer’s V = .53).