# edps 589 # c.j.anderson # # Symmetry for Siskell & Ebert data set: # Did Siskell and Ebert agree with each other? # Source: Chance. # library(vcd) library(vcdExtra) def <- expand.grid(Ebert<-c("Con","Mixed","Pro"), Siskel<-c("Con","Mixed","Pro")) movies <- data.frame(def,count=c(24,8,13,8,13,11,10,9,64)) names(movies)<- c("Ebert","Siskel","count") movies.tab <- xtabs(count ~ Siskel + Ebert,data=movies) (addmargins(movies.tab)) # # Independence # summary(ind <- glm(count~ Siskel + Ebert,data=movies,family=poisson)) # # Quasi Independence # movies$qi <- c(1,0,0, 0,2,0, 0,0,3) movies$qi <- as.factor(movies$qi) summary(qi.fit <- glm(count~Siskel+Ebert+qi, data=movies,family=poisson)) round(1-pchisq(qi.fit$deviance,qi.fit$df.residual),digits=2) # # Symmetry # movies$sym <- c(1,4,5, 4, 2,6, 5, 6,3) movies$sym <- as.factor(movies$sym) summary(sym.fit <- glm(count~sym, data=movies,family=poisson)) round(1-pchisq(sym.fit$deviance,sym.fit$df.residual),digits=2)