# Test for independence of two categorical variables, using raw data # instead of cross-tabulated counts. # Data: GPA/ACT data set for stat 251 students, 2014. # Categorical variables were SEX, HOUSING, COLLEGE. gpa.data=read.table("gpa_data_f2014.txt",header=TRUE) attach(gpa.data) table(SEX,COLLEGE) chisq.test(SEX,COLLEGE) table(SEX,HOUSING) chisq.test(SEX,HOUSING) table(HOUSING,COLLEGE) chisq.test(HOUSING,COLLEGE) detach(gpa.data)