Mathematics can be used to describe processes we see everywhere! We can use maths to model how cancerous tumours form, how diseases spread in populations and how the patterns on animals coats form.

My favourite application of such mathematical models is in Mathematical Ecology. Here we use mathematics to describe processes in ecology. These help us understand more about how animals and plants interact.

In this post I am going to describe how an animal might move across its landscape using mathematics.

To start, the most important thing about mathematical modelling is to know enough about the ecology we are trying to model!

For example, if we are modelling how something grows in biology we need to understand the factors which drive growth, such as speed and the initial size. Once we know enough, we can then think about writing a suitable model.

We’re going to look at modelling the movement of a Jaguar in the Amazon rain forest.

The Earth’s Rainforests are disappearing at an alarming rate. Its currently so fast that in a century they will all be gone. Understanding how a top predator uses its space is important when finding ways to save it!

When we are looking at how to model an animal about its landscape we need some information about the places it goes and the steps it takes. We will start by following a Jaguar and writing down its position every minute for a few hours.

We can think about the Jaguar’s landscape as 2D space and its positions as (x,y) coordinates.

Looking at the coordinates as time goes on, we have an estimate of the movement path of the Jaguar (the arrows in Figure 1 show the path). This is only an estimate as we only wrote the position down every minute and the Jaguar moves in a smooth motion (a continuous path).

From these GPS positions we can create two histograms.

- One for the step lengths – that is the distance travelled each minute.
- One for each angle turned through from the previous step to the next step (shown above).

This gives the following histograms

The reason we create these histograms is to create something called *Probability Distributions. *These give us is a way to choose the most likely step and turning angle for the Jaguar, for each simulated step in our model.

Once the histograms have been created we ‘fit’ these to a continuous probability distribution, these are the curves shown. Fitting means we find a curve which is most like the shape of our histogram. This line will help us choose probabilities.

Here we fit something called the *Normal Distribution*, but many other distributions can be tried to find the best one. These give us a mathematical form for the probabilities (like an equation).

These probability distribution curves are going to help us model the jaguars steps. Our model will need to simulate each step and turning angle to draw a path – **This is the model.**

To understand more the purpose of these probability distributions we can think of them in terms of a box of coloured counters:

The probability of picking each colour of counter approximately represents the probability of picking each step length above in Figure 2. Here there are 27 dark green counters out of a total of 108. 27/108 = 0.25, which if you look at the step-length distribution in Figure 1 is around the same.

We can use the box of counters to think about how we will ask a computer to use the curve of the probability distribution to choose a step length for our model. Imagine mixing all the counters together, closing your eyes and picking one out at random . The most likely counter is dark green, but any colour is possible. This is what the graphs represent.

The computer will choose a step length (metres) and a turning angle (degrees), just like picking a coloured counter. Some are more likely than others and that’s what the graph shows. Look at the graphs in Figure 2 again, the most likely step is 0 metres, meaning the Jaguar is most likely to do a small step. The most likely angle is 0 metres, meaning the Jaguar is most likely to continue the way it was going.

Lets now think more about what else could influence the movement of a Jaguar. This is where the real biology comes in! Although, as mathematicians we like to start simple.

Jaguars are elusive creatures so lets propose that they *prefer to be underneath trees rather than out in the open.*

Now lets look at the entire landscape, where we previously recorded the Jaguar’s steps. Here we can see the whole view

So lets say we know a position of the Jaguar and we are considering where he might travel to next, in the time-step of 1 minute.

Here’s four options (arrows):

- Moving to the space west could be considered unlikely as there is no tree cover.
- The closest north-east movement could be likely as it is moving towards more tree cover.
- The movement into the sea is very unlikely or maybe even impossible for the jaguar to move that far in one minute.
- The movement south seems likely over time, but maybe too far to travel in 1 minute.

We have only looked at four possibilities here. How many are there in this rectangular domain? Infinitely many! Infinity is a hard number to work with.

So instead we consider *discretising the space *. We have already *discretised time,* as we are looking the position only every minute. We will also do this over space by drawing a grid:

Now movement is only from somewhere in one square to somewhere in another. Realistically we are saying that the Jaguar could be anywhere in each cell but we only care about moving from one cell to the next. This gives us a finite amount of movement possibilities, 576 to be exact.

So lets say the yellow square is the last place we saw the Jaguar and propose a model.

We propose that the Jaguar’s movement is determined by

- the distance to another cell
- the angle turned through to get to a cell
- the amount of tree cover the cell has.

We’ve already determined how to find the distance and angle. What about the tree cover? Simple, we go to each cell and give it a value between 0 and 1 based on how covered it is by trees. For example:

So, for the cells shown above, if its half covered by trees it is given a value of 0.5. The cell completely covered by trees is given a value of 1. The cell in the sea has zero trees, but zero wouldn’t be a great number to use (we are going to multiply), so we allocate a really small number.

Now lets propose our model! To understand this I want to draw your attention back to basic probability. What is the probability of rolling a 5 on a normal dice? It’s 1 in 6 of course or $$\frac{1}{6}$$ so

$$ P(\text{5 on dice}) = \frac{1}{6}$$.

What about the probability of choosing a Queen of Hearts at random from a pack of ordinary cards?

$$P(\text{Queen of Hearts}) = \frac{1}{52}$$

So the dice had 6 possible outcomes and the cards have 52 possible outcomes.

What about rolling a 5 and picking the Queen of Hearts?

$$P(\text{both}) = \frac{1}{6} \times\frac{1}{52}=\frac{1}{216}$$

So there’s 216 chances here!

Our model is similar to this, **here’s the important part, the mathematical form!** So for each cell in our landscape, we will assign a probability of being chosen, based on the Jaguar’s current position. This is the formula we will use for each cell:

$$P(\text{Moving to cell}) = \frac{P(\text{Distance})\times P(\text{Angle})\times (\text{Tree})}{\sum(\text{Probabilities of all cells})}$$

where

$$\sum$$ means to add all the things after it up and

- Distance= The distance to travel to the cell
- Angle=The angle turned through to travel to the cell
- Tree=The value based on tree coverage

So every time the Jaguar takes a step, we calculate this for every cell in the landscape. This gives us a *two-dimensional probability distribution* for the computer to choose cells from.

To understand this better, lets look at a small part of the landscape

Here we can see the values of each cell based on the formula above and the current location of the Jaguar. We ask the computer to choose a cell, the highest probability is the most likely, but all cells are possible.

Just like choosing a coloured counter from the box! But instead we are choosing a cell and some are more likely than others.

Once we have chosen a cell the Jaguar moves and they are all calculated again. So each movement requires 576 calculations! One for each cell.

Using a computer to calculate these is quite necessary!

Okay, lets take a look at the model in action and simulate the Jaguars path!

Looks good, but whats the problem? The walls of our rectangle are restricting the path, but those walls arent there really.. How can we write a better model? More information!

What else could be driving the movement of our Jaguar? Let’s say she has a den and a litter of cubs, and we know the location!

So we’d expect the Jaguar to be more likely to move to a cell nearer to the den.

Now we will incorporate this into our old model to form a new model and see if its any better!

$$P(\text{Moving to cell}) = \frac{P(\text{Distance})\times P(\text{Angle})\times (\text{Tree})\times (\text{Nest})}{\Sigma(\text{Probabilities of all cells})}$$

where

- Distance= The distance to travel to the cell
- Angle=The angle turned through to travel to the cell
- Tree=The value based on tree coverage
- Nest = A value which is larger the nearer to the nest the cell is.

Okay, following the same process as before but using the new formula, lets simulate the Jaguars movement again

There we go! We can clearly see the Jaguars usual space use forming! We’d call this an animals home-range. Modelling home ranges is the subject of my PhD Research at the University of Sheffield.

I hope I’ve managed to give you an insight of the basic ideas in Mathematical Movement Ecology!

**Extensions of the model and other points:**

This model has been introduced as the most simple model to introduce the ideas to everyone! There are lots more aspects of a Jaguar’s behaviour we could include, such as territoriality and movement of prey. In real life Jaguars may move away from places they have detected other Jaguars and move towards prey. Its complicated but we could incorporate this too!

It may not be completely obvious how our formulae relates to the data. In this example this is by creating the probability distributions for the steps and angles. Hidden in the models we would have parameters (constants such as speed) associated with each part of the model. These parameters can be changed using a special algorithm to find the most likely parameters for our data!

For any reading mathematicians, in part 2 I write about a less simple general form for these models, with the use of parameters and a way to find the best parameters for the data. These are called ‘Step-Selection Models’ in the literature.