I’m currently teaching Ecological Statistics and Data, a class I inherited from Lee Brown and Elizabeth Crone. In a lecture on population dynamics, they do some really cool things with generalized linear model—things that I don’t think are standard practice and as far as I can tell from googling, aren’t well documented. And let me tell you, I did a lot of googling to make sure I understood this stuff before teaching it. So, I thought I’d put it up on the blog for others.
Data
I’ll be using data on the Northern Rocky Mountain grey wolf population. You can read more about the history of these wolves here.
library(tidyverse)wolves <-read_csv("NRMwolves.csv") %>%mutate(year_post = year -1982) head(wolves)
# A tibble: 6 × 8
year num.wolves MT.wolves WY.wolves ID.wolves OR.wolves WA.wolves year_post
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1982 8 8 NA NA NA NA 0
2 1983 6 6 NA NA NA NA 1
3 1984 6 6 NA NA NA NA 2
4 1985 13 13 NA NA NA NA 3
5 1986 15 15 NA NA NA NA 4
6 1987 10 10 NA NA NA NA 5
Exponential growth
Exponential growth describes unregulated reproduction and is described by the equation:
\[
N_{T} = \lambda^TN_0
\]
where \(\lambda\) is the population growth rate, \(T\) is a number of time steps (e.g. years) and \(N_0\) is the population at some initial time.
Hacking an exponential growth rate GLM
We can take advantage of a log-link to linearize this equation:
\[
log(N_T) = log(N_0) + log(\lambda)\times T
\]
Compare to a generic GLM equation with a log-link:
\[
log(y)= \beta_0 + \beta_1x_1
\]
Here’s the glm for an exponential growth model fit to the wolf data:
m_exp <-glm(num.wolves ~ year_post, family =poisson(link ="log"), data = wolves)exp(coef(m_exp))
(Intercept) year_post
19.615307 1.176583
The backtransformed intercept is the estimate for \(N_0\), the estimated number of wolves at year_post = 0
The backtransformed coefficient for year_post = \(\lambda\), the population growth rate
Process error
The exponential growth model fit above is an observation error model. It assumes variation from predicted values are due to inaccuracies in estimating the number of wolves.
A process error model estimates a population growth that depends on current population size. This can be modeled as a rate, \(N_{t+1}/N_{t}\).