library(car)
# using glm()
berkeley <- as.data.frame(UCBAdmissions)
cellID <- paste(berkeley$Dept, substr(berkeley$Gender, 1, 1), "-", substr(berkeley$Admit, 1,
3), sep = "")
rownames(berkeley) <- cellID
berk.mod <- glm(Freq ~ Dept * (Gender + Admit), data = berkeley, family = "poisson")
summary(berk.mod)
##
## Call:
## glm(formula = Freq ~ Dept * (Gender + Admit), family = "poisson",
## data = berkeley)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.478 -0.414 0.010 0.309 2.232
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 6.2756 0.0425 147.74 < 2e-16 ***
## DeptB -0.4057 0.0677 -5.99 2.1e-09 ***
## DeptC -1.5394 0.0831 -18.54 < 2e-16 ***
## DeptD -1.3223 0.0816 -16.21 < 2e-16 ***
## DeptE -2.4028 0.1101 -21.82 < 2e-16 ***
## DeptF -3.0962 0.1576 -19.65 < 2e-16 ***
## GenderFemale -2.0333 0.1023 -19.87 < 2e-16 ***
## AdmitRejected -0.5935 0.0684 -8.68 < 2e-16 ***
## DeptB:GenderFemale -1.0758 0.2286 -4.71 2.5e-06 ***
## DeptC:GenderFemale 2.6346 0.1234 21.35 < 2e-16 ***
## DeptD:GenderFemale 1.9271 0.1246 15.46 < 2e-16 ***
## DeptE:GenderFemale 2.7548 0.1351 20.39 < 2e-16 ***
## DeptF:GenderFemale 1.9436 0.1268 15.32 < 2e-16 ***
## DeptB:AdmitRejected 0.0506 0.1097 0.46 0.64
## DeptC:AdmitRejected 1.2091 0.0973 12.43 < 2e-16 ***
## DeptD:AdmitRejected 1.2583 0.1015 12.40 < 2e-16 ***
## DeptE:AdmitRejected 1.6830 0.1173 14.34 < 2e-16 ***
## DeptF:AdmitRejected 3.2691 0.1671 19.57 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 2650.095 on 23 degrees of freedom
## Residual deviance: 21.736 on 6 degrees of freedom
## AIC: 216.8
##
## Number of Fisher Scoring iterations: 4