# Quantitative Ecotoxicology, Page 223, Example 5.1, Using GLM

Previously, I showed how to analyse the fish survival data using the arcsine square root transformation.
Warton & Hui (2011) demonstrated that *the arcsine transform should not be used in either circumstance*, but instead use Generalized Linear Models.
This post is about how to analyse example 5.1 on page 223 of Quantitative Ecotoxicology using Generalised Linear Models.

### Introduction

Data of this type (*x out of n*) can be directly modelled using a binomial distribution.

The binomial distribution is described by two parameters:

where N is the number of fish and $\pi$ is the probability of survival.

Here I plotted the binomial distribution for ten fish at different probabilities ($\pi = 0.5, 0.75, 0.95, 0.05$), to give you a feeling how this distribution looks like at difference $\pi$:

### The Model

We can now build a model, where the probability of success is a function of treatment:

Let’s explain this a little bit:

, basically says: We assume that the number of dead fish ($y$) binomially distributed, where N = exposed animals and $\pi$ i is the probability of survival, which together give the expected number of surviving fish ($E(y) = N \times \pi$).

, basically says: We are modelling the probability of survival as function of treatment (x) [note the right-hand side of the formula is similar to linear regression]. However, we need to ensure that , and therefore the relationship is on the logit scale. The estimated parameters ($\beta) are directly interpretable as changes in log odds between treatments.

, says that variance of the binomial distribution is a quadratic function of the mean. Note, that in linear regression we assume a constant variance.

### How to do it in R?

First I read again the data into R and prepare it:

The compute a binomial GLM in R we can use the `glm()`

function:

Note, that I use the `weights`

argument to specify that in each tank we had 10 fish (N in the above formulas).
The summary gives the estimated parameters:

The estimates for `(Intercept)`

are the log odds to survive in the treatment:

Similar the log odds for the highest treatment:

The estimate for `conc512`

(-3.675) gives you the difference in the log odds, as can be seen here:

Note, that this kind of interpretation is not possible with the arcsine transformation.

#### Hypothesis tests

Similar to the previous post we can perform an F-Test:

Or do multiple comparisons:

### Which one is better?

I would say GLMs! They have greater power (Warton & Hui, 2011), are simpler to interpret and are readily available in most software packages.

#### References

- Warton, D. I., & Hui, F. K. (2011). The arcsine is asinine: the analysis of proportions in ecology. Ecology, 92(1), 3-10.