animals=read.table("http://www.unt.edu/rss/class/mike/data/animals.txt", header=T) library(MASS) #Logistic Regression GLM.0= glm(decision ~ 1, family=binomial(logit), data=animals) summary(GLM.0) AIC(GLM.0, k = log(nobs(GLM.0))) # BIC GLM.1 <- glm(decision ~ idealism + relativism + gender + research, family=binomial(logit), data=animals) summary(GLM.1) confint(GLM.1, level=.95, type="LR") AIC(GLM.1, k = log(nobs(GLM.1))) # BIC indicates a significantly better model #First compare the two model BIC (lower better). Here is a statistical test. anova(GLM.0,GLM.1, test="Chisq") predict(GLM.1, type="response") table(GLM.1$y,fitted(GLM.1)>.50) #Except for rounding, this will reproduce the table from SPSS #226/315 = 71.7% correct classification #DFA on the same data dfa.mod <- lda(decision ~ idealism + relativism + gender + research, data=animals) dfa.mod predclass=predict(dfa.mod)$class table(decision,predclass) #228/315 = 72.4% correct classification, slightly better than logreg