Ornstein1 <- read.table("c:/temp/Ornstein.txt",header=TRUE) Ornstein1$assets2 <- Ornstein1$assets/1000 Ornstein1.glm1 <- glm(interlocks ~ as.factor(sector) +as.factor(nation) +assets2, data=Ornstein1,family=poisson()) summary(Ornstein1.glm1) par(mfrow=c(2,2)) plot(Ornstein1.glm1) par(mfrow=c(1,1)) # These three reduced models give the residual deviances in the Table on page 388 summary(glm(interlocks ~ as.factor(sector) +as.factor(nation) , data=Ornstein1,family=poisson()) ) summary(glm(interlocks ~ as.factor(sector) +assets2, data=Ornstein1,family=poisson()) ) summary(glm(interlocks ~ as.factor(nation) +assets2, data=Ornstein1,family=poisson()) ) # the effects package can produce effects plots like those on page 390 library(effects) # the as.factor function cannot be used in the glm formula with the effects # functions, so here they are defined as separate variables Ornstein1$fnation <- as.factor(Ornstein1$nation) Ornstein1$fsector <- as.factor(Ornstein1$sector) Ornstein1.glm1a <- glm(interlocks ~ fsector +fnation +assets2, data=Ornstein1,family=poisson()) plot(effect("fsector", Ornstein1.glm1a)) plot(effect("fnation", Ornstein1.glm1a)) plot(effect("assets2", Ornstein1.glm1a))