Linear algebra, age structure, and eigenpopulations

Next we'll be learning some linear algebra, which gives us the tools we need to generalize what we've done so far to higher dimensions. We'll follow Otto & Day in doing this in the context of age and stage structured populations.

We're also going to focus on the short term dynamics of these populations: for reasons that will be clear later, we won't be concerned about long-term stability.

Linear algebra

A quick intro on the board to:

  1. Vector addition (+): vectors as displacements
  2. Matrix-vector multiplication (@): square matrices as transformations
  3. Matrix-matrix multiplication (@): composing two transformations
  4. Matrices as systems of linear equations (np.linalg.solve( ))

Problems: let $$ M = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix} $$ and $$\begin{aligned} x = \begin{bmatrix} 3 \\ -6 \\ 9 \end{bmatrix} & \qquad & y = \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix} . \end{aligned}$$

  1. Find $x + y$.
  2. Find $M x$.
  3. Show that $M(x+y) = Mx + My$.
  4. Show that $M(Mx) = (M^2)x$.
  5. Find the vector $u$ so that $Mu = x$.

Life stages (aka class-structured populations)

Let's go back to thinking about a single species, but keeping track not just of how many individuals there are, but also what life stage or class they are all in. We could keep track of this just as a list of life stages - if there are $N$ individuals, this would be a list of $N$ numbers. But it's tidier to keep track of the census: for each possible class, how many individual are there of that age? We'll write that as follows: $$ N_k(t) = \text{(number of class-$k$ individuals alive at time $t$)} . $$

Example: juveniles/adults

Let's start with the simplest example.

The discrete-time (deterministic) equation is $$ \begin{aligned} N_J(t+1) &= 0 N_J(t) + b N_A(t) \\ N_A(t+1) &= p_j N_J(t) + p_a N_A(t) . \end{aligned} $$ Using the matrix $$\begin{aligned} M = \begin{array}{c c} & \begin{array}{@{} c c @{}} J\hphantom{0} & \hphantom{0}A \end{array} \\ \begin{array}{c} J \\ A \end{array}\hspace{-1em} & \left( \begin{array}{@{} c @{}} 0 & b \\ p_j & p_a \end{array} \right) \\ \mbox{} \end{array} \\[-12pt] , \end{aligned}$$ and $N = (N_J, N_A)$, we can write this same system of equations concisely as $$ N(t+1) = M N(t) . $$

What's this system do?

Eigendirections

Eigenvectors of a matrix are directions unchanged by its transformation. In symbols, this is $$ Mv = \lambda v $$ where $\lambda$ is a number, called the eigenvalue.

Exercises:

  1. Check that $(1, 0)$ and $(0, 1)$ are eigenvectors of $$ M = \begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix} . $$ What are the eigenvalues?

  2. Use np.linalg.eig( ) to find the eigenvalues and vectors of $$ M = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix} $$ Double-check the equation holds.

  3. The formula corresponding to "change into the coordinates of the eigenvectors, multiply by the eigenvalues, and change coordinates back" is $$ M = U \text{diag}(\lambda) U^{-1} , $$ where $U^{-1}$ is the inverse matrix (scipy.linalg.solve(U, np.eye(U.shape[0]))) and $\text{diag}(\lambda)$ is the matrix with the values of $\lambda$ on the diagonal and zeros elsewhere. Check this holds.

Example: eigenvectors

Here's the vector field defined by the transformation we get from $$ M = \begin{bmatrix} 2 & 1 \\ 1/2 & 1 \end{bmatrix} , $$ with the eigenvector directions superimposed.

Eigenanalysis of a stage-structured model

We're going to find the time course of the linear model $$ N(t) = M^t N(0) , $$ using the eigendecomposition of $M$. If we can do an eigendecomposition, it looks like $$ M = U \text{diag}(\lambda) U^{-1} , $$ and so $$ M^t = U \text{diag}(\lambda^t) U^{-1} . $$

Written out, this says that to find the vector $N(t)$, we need to

  1. Find the eigenvector loadings of the initial state: $$ V(0) = U^{-1} N(0) . $$ These say how strongly the initial state "excites" each of the eigendirections.

  2. Multiply each of these loadings by the corresponding eigenvalue to the power $t$, i.e., $\lambda^t$: $$ V(t)_k = \lambda_k^t V(0)_k . $$ These give the contributions of each eigendirection at time $t$.

  3. Shift back to the original coordinates by multiplying by the matrix of eigenvectors, $U$: $$ N(t) = U V(t) .$$

Eigenanalysis of the juvenile-adult example

We'll apply this to the juvenile-adult model above.

Example: right whales

For instance, the classes for females in a right whale population model were:

Individuals transition from calf to immature in one year; can stay immature for more than one year; then transition between mature and reproductive as adults. Each class has a separate death rate, and only reproductive individuals produce new offspring. The parameters of the model are concisely encoded in the following matrix: $$ S = \begin{array}{c c} & \begin{array}{@{} c c c c @{}} C\hphantom{0} & I\hphantom{0} & \hphantom{0}M & \hphantom{0}R \end{array} \\ \begin{array}{c} C \\ I \\ M \\ R \end{array}\hspace{-1em} & \left( \begin{array}{@{} c c c c @{}} 0 & 0 & 0 & b \\ s_{IC} & s_{II} & 0 & 0 \\ 0 & s_{MI} & s_{MM} & s_{MR} \\ 0 & s_{RI} & s_{RM} & s_{RR} \end{array} \right) \\ \mbox{} \end{array} \\[-12pt] $$ There are nine parameters. All the $s_{XY}$ parameters have the same interpretation: they give the probability that a given individual currently in class $Y$ will be in class $X$ next time step. For instance, a calf will either

while an immature individual will either

The remaining parameter, $b$, is the mean number of births per reproductive individual per year.

Excercise: Write a paragraph describing the whale models, with these parameters. (e.g., "92% of the calves born each year survive until the next year, in which case they join the 'immature' class.")

That predicts that at $b=0.2$, the population will die out (slowly, decreasing by $\approx$ 99% per year), and above $b=0.3$ it will not (again, increasing slowly). Let's see.

Stable age distributions

Clearly, there's some nonequilibrium stuff going on at the start of those simulations. I chose starting age distributions that weren't natural at all -- too many juveniles, given the long lifetimes of adults and relatively low birth rates. How could we have predicted this?

It turns out that in a linear model, the long-term behavior is governed by the "top" eigenvalue and its eigenvectors. Call $\lambda_0$ the largest eigenvalue (largest in absolute value; it is always real); and $v$ the corresponding eigenvector. Then

  1. The long-term growth rate of the entire population is $\lambda_0$, i.e., $\sum_j N_j(t)$ grows like $\lambda_0^t$.

  2. The long-term age distribution is proportional to $v$, i.e., $$ \frac{N_j(t) }{ \sum_k N_k(t) } \approx \frac{ v_j }{ \sum_k v_k }.$$

Let's check this in the whale model above.

Homework

Modify the whale model to include randomness. See how well the growth rate and long-term age structure match the deterministic predictions. (They should match quite well!)