Created
May 2, 2012 00:40
-
-
Save inkhorn/2572673 to your computer and use it in GitHub Desktop.
Scripted example of using chisq to mine for relations between nominal variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testvars = c(6,7,9,10,11,12,13,14,16, 17,18,19,20,21,23,24,25,26,384,375,376,386,385,387,388) | |
resultlist = c() | |
for (i in testvars) { | |
xsq = chisq.test(big.dataset[,i], big.dataset$DV_3lvls)$statistic | |
varname = names(big.dataset)[i] | |
tab = xtabs(~DV_3lvls + big.dataset[,i], data=big.dataset) | |
resultlist = rbind(resultlist, list(chisq=xsq, testvar=varname, xtab=tab)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment