rm(list = ls()) abt <- read.table( url("http://stat.unm.edu/~fletcher/LLM/DATA/TAB3-1.DAT"), #"C:\\E-drive\\Books\\ANREG2\\newdata\\TAB21-4.DAT", #"C:\\E-drive\\Books\\LOGLIN3\\DATA\\Tab3-1.dat", sep="",col.names=c("R","S","A","O","y")) attach(abt) abt #summary(abt) r=factor(R) o=factor(O) s=factor(S) a=factor(A) mm <- glm(y ~ r:s:o + o:a ,family = poisson) mms = summary(mm) rpearson=(y-mm$fit)/(mm$fit)^(.5) rstand=rpearson/(1-hatvalues(mm))^(.5) infv = c(y,mm$fit,hatvalues(mm),rpearson,rstand, cooks.distance(mm)) inf=matrix(infv,I(mms$df[1]+mms$df[2]),6,dimnames = list(NULL,c("n","mhat","lev","Pearson","Stand.","C"))) inf index=c(1:72) plot(index,hatvalues(mm),ylab="Leverages", xlab="Index") boxplot(rstand,horizontal=TRUE, xlab="Standardized residuals") plot(index,rstand,ylab="Standardized residuals", xlab="Index") qqnorm(rstand,ylab="Standardized residuals") boxplot(cooks.distance(mm),horizontal=TRUE, xlab="Cook's distances") plot(index,cooks.distance(mm),ylab="Cook's distances", xlab="Index")