# How to analyze count data with a categorical predictor and no control treatment

I have a dataset looking at the occurrence of locations inside and outside of individual diurnal home ranges. Daytime home ranges were built for multiple individuals (5-10 individuals) for each of 5 species. Then I mapped the occurrence of relocation data at night for each individual over the course of days to months. That means I have huge variation in the number of nighttime locations per individuals ranging from just 3 up to 34. In the end I have a dataset of the number of nighttime locations that fall within the daytime home range and a number that fall outside of this daytime home range. I would like to see if there are differences between species in the amount of nighttime locations inside and outside of the daytime home range.

My data looks something like this called 'night'

Species, Indiv, Total Nights, Nights In, Nights out,

BRWE 1 3 3 0

BRWE 2 3 2 1

BRWE 3 4 4 0

BRWE 4 5 5 0

BRWE 5 7 6 1

BRWE 6 10 4 6

MAFD 1 3 2 1

MAFD 2 6 5 1

MAFD 3 8 5 3

MAFD 4 10 10 0

MAFD 5 10 10 0

MAFD 6 11 8 3

MAFD 7 34 33 1

MIST 1 3 3 0

MIST 2 3 3 0

MIST 3 4 4 0

MIST 4 5 5 0

MIST 5 5 5 0

MIST 6 7 7 0

MIST 7 7 4 3

MIST 8 15 6 9

MIST 9 23 10 13

WTGD 1 4 2 2

WTGD 2 5 5 0

WTGD 3 7 4 3

WTGD 4 8 6 2

WTGD 5 11 5 6

WTGD 6 33 13 20

I began with a basic glm in R: mod<-glm(cbind(Nights In,Nights out)~Species,family=binomial,data=night) But this glm wants to compare back to a control variable. In this case that control is the the first species in the list BRWE. I would like to look for differences among all species combinations.

Let $S$ be the number of species in the model, and let $x_{is}$ be equal to $1$ if observation $i$ is species $s$ and $0$ otherwise. For each row of your data, we can write the linear predictor in this model as $$\eta_i = \alpha + \sum_{s=2}^S \beta_s x_{is}$$ so that the expected difference between species $s$ and species $1$ in the linear predictor is equal to $\beta_s$.
Now you want to compare two arbitrary species $s$ and $t$. That is easy to do using this model. Consider that the $\left(\beta_t + \alpha\right)$ is the value of the linear component for species $t$, and that $\left(\beta_s + \alpha\right)$ is the value of the linear component for species $s$. Now that these values are situated correctly along the number line, all we have to do to compare species $s$ and $t$ is to take the difference $\left(\beta_t + \alpha\right) - \left(\beta_s + \alpha\right) = \left(\beta_t - \beta_s\right)$. The effect of one species relative to another is just the difference in their respective regression coefficients.
Think of it another way: all the coefficients are defined against the same reference point $\alpha$. That is, the "effect" of species $s$ versus the reference species is $\left(\beta_s + \alpha\right) - \alpha$. The effect of the reference species versus itself is $\alpha - \alpha = 0$. In this case, we can shift the reference point from $\alpha$ to $\left(\beta_s + \alpha\right)$, in which case the effect of species $s$ becomes $\left(\beta_s + \alpha\right) - \left(\beta_s + \alpha\right)=0$, and the effect of the original reference species becomes $\alpha - \left(\beta_s + \alpha\right) = -\beta_s$. With reference point shifted to the absolute level of species $s$, the effect of species $t$ relative to $s$ is just the difference $\left(\beta_t - \beta_s\right)$.
In general, you can arbitrarily shift the reference point by some number $m$ by subtracting $m$ from each coefficient. So if we shift the reference point to $m = \beta_s$, then to get the new, re-referenced coefficient for species $t$ we subtract off $m$, obtaining $\beta_t - m = \beta_t - \beta_s$.