This might be a question that could be answered relatively quickly if I knew more terminology.
Am I correctly performing a chi-squared test for independence on the JOB
variable?
CD %>% select(JOB, DEFAULT) %>%
table() %>% chisq.test()
unique(CD$JOB)
[1] SkilledEmployee/Official
[2] Unemployed/Unskilled:Resident
[3] Mgr/SelfEmployed/HighlyQualified Employee/Officer
[4] Unemployed/Unskilled:NonResident
4 Levels
Thank You.
You Almost got it right. Null hypothesis would be that the categics are independent. H1 would be they are not independent.
Run the test like this, there is no need for dplyr::select on the df CD.
chisq.test(table(CD$JOB,CD$DEFAULT))