library(readxl)
library(ggpubr)
## Loading required package: ggplot2
library(rcompanion)
library(rmarkdown)
A4Q2 <- read_excel("//apporto.com/dfs/SLU/Users/brentgallagher_slu/Desktop/A4Q2.xlsx")
table(A4Q2$status, A4Q2$scholarship)
##
## 0 1
## Domestic 39 111
## International 118 32
table <- table(A4Q2$status, A4Q2$scholarship)
table
##
## 0 1
## Domestic 39 111
## International 118 32
barplot(table, beside = TRUE,
col = rainbow(nrow(table)),
legend = rownames(table),
main = "Status and Scholarship",
xlab = "No or Yes",
ylab = "Count")

# In my first attempt my code for the bar chart was different.
chi_result <- chisq.test(table)
chi_result
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table
## X-squared = 81.297, df = 1, p-value < 2.2e-16
## Pearson's Chi-squard test with Yate's continuity corretion.
## X-squared = 81.297, df = 1, p-value < 2.2e-16
# I didn't have lines 21 and 22 in my first attempt.
rcompanion::cramerV(table)
## Cramer V
## 0.5272
# A Chi-Square Test of Independence was conducted to determine if there was an association between scholarships and nationality.
# The results showed that there was an association between the two variables X-squared(1) = 81.30, p < .001.
# The assocation was strong (Cramer's V = .53).
# I didn't round up in my fist attempt.