---
title: "Overdisp"
author: "Nov 17"
date: "17/11/2021"
output:
  html_document: default
  pdf_document: default
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(faraway)
library(SMPracticals)
data(troutegg)
```

```{r}
ftable(xtabs(cbind(survive,total) ~ location + period, data = troutegg))

bmod <- glm(cbind(survive,total-survive) ~ 
              location + period, 
            family = binomial, 
            data = troutegg)

summary(bmod)

# plot(bmod)

bmod2 <- glm(cbind(survive,total-survive) ~ 
               location + period,
             family = quasibinomial,
             data = troutegg)

summary(bmod2)
plot.glm.diag(bmod2) ## see SM Section 10.2.3
```