library(faraway)

ELMR 3.2

data("salmonella")

The salmonella data was collected in a salmonella reverse mutagenicity assay. The predictor is the dose level of quinoline and the response is the numbers of revertant colonies of TA98 salmonella observed on each of three replicate plates. Show that a Poisson GLM is inadequate and that some overdispersion must be allowed for. Do not forget to check out other reasons for a high deviance.

colnames(salmonella)
## [1] "colonies" "dose"
head(salmonella,10)
##    colonies dose
## 1        15    0
## 2        21    0
## 3        29    0
## 4        16   10
## 5        18   10
## 6        21   10
## 7        16   33
## 8        26   33
## 9        33   33
## 10       27  100
plot(salmonella)

m<-glm(dose~.,family = poisson,salmonella)
summary(m)
## 
## Call:
## glm(formula = dose ~ ., family = poisson, data = salmonella)
## 
## Deviance Residuals: 
##    Min      1Q  Median      3Q     Max  
## -21.84  -17.97  -14.86    2.46   40.34  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) 4.891047   0.040642  120.34   <2e-16 ***
## colonies    0.020105   0.001177   17.09   <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: 7889.6  on 17  degrees of freedom
## Residual deviance: 7615.1  on 16  degrees of freedom
## AIC: 7716.1
## 
## Number of Fisher Scoring iterations: 6
halfnorm(residuals(m))

plot(log(fitted(m)),log((salmonella$dose-fitted(m))^2),xlim=c(5,6.5),ylim=c(5,14))
abline(0,1)

(dp <-sum(residuals(m,type="pearson")^2)/m$df.res)
## [1] 593.2436
summary (m, dispersion=dp)
## 
## Call:
## glm(formula = dose ~ ., family = poisson, data = salmonella)
## 
## Deviance Residuals: 
##    Min      1Q  Median      3Q     Max  
## -21.84  -17.97  -14.86    2.46   40.34  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  4.89105    0.98990   4.941 7.77e-07 ***
## colonies     0.02010    0.02866   0.702    0.483    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for poisson family taken to be 593.2436)
## 
##     Null deviance: 7889.6  on 17  degrees of freedom
## Residual deviance: 7615.1  on 16  degrees of freedom
## AIC: 7716.1
## 
## Number of Fisher Scoring iterations: 6
drop1(m,test="F")
## Warning in drop1.glm(m, test = "F"): F test assumes 'quasipoisson' family
## Single term deletions
## 
## Model:
## dose ~ colonies
##          Df Deviance    AIC F value Pr(>F)
## <none>        7615.1 7716.1               
## colonies  1   7889.6 7988.6  0.5766 0.4587