Lab: Introduction to Ecological Modelling
This lab is about modelling ecological population dynamics, which means the way that populations change over time. You are encouraged to collaborate with others in working through this lab, but do make sure that you fully understand what is going on.
This lab will be closely related to a questions on the assignment. You will answer the questions on the assignment (about this lab) through entering answers into an online LMS ‘quiz’. You will not be able to access the quiz itself during the labs – it will open later. As you go through this lab sheet, write down notes in the space provided for the questions marked with a *, either in pen or in the word document. These will help you check your understanding as you go and form the basis of your answers for the assignment quiz. Pasting plots into this word doc can also be very useful, so you can look back at them to help with the quiz later. When you start writing your R script, make sure it is neat and structured, as you will have to submit that too. But you will not have to submit this document or any written report on this lab.
Part 1: Population Dynamics and Competition
While the ideas of modelling population dynamics will be very similar for many different species and situations, for this exercise we can assume that we are modelling the density of a species of mouse, that the time step is in months, and the density is the number of individuals per square kilometre. For other species we might use different spatial and temporal scales.
First we will work with the ‘intro ecological modelling.R’ file from LMS. There are some basic intro
evision things at the start. Work through those and check that you understand the loops and the creation of the vectors. Ask questions about anything that isn’t clear. Work through until you’ve got to the unbounded growth model, and check you understand how that works.
Look at the plot of time against density, so you can see how density is changing over time.
*What do you notice?
Look at the formula
pop[time] = pop[time-1] + growthrate * pop[time-1].
This means that the new population density is the old one plus a certain proportion of the old one. This proportion is the reproduction rate; a value of 0.1 means that, on average, each mouse in the population produces 0.1 babies per month. Try changing this rate and see what happens in the graph (You’ll need to rerun the model and replot the results each time you change something of course).
*What happens when you increase the reproduction rate?
In more mathematical notation this equation could be written as:
dt+1= dt + r dt
Now extend the model to time=100. Also extend the graph to time=100. What do you see now?
* What happens if you reduce the reproduction rate? (Change it back to 0.1 when you’re done.)
*Why is this not a realistic model of population growth?
One thing we haven’t accounted for is the fact that animals die as well as reproduce. Add a death rate parameter equal to 0.05 to the R code. Adapt the equation to account for this death rate as well as the reproduction (birth) rate.
*What happens?
At the moment we are assuming that death rate is constant, but in reality it is likely to increase as the population gets large and resources become limiting. Instead of a constant death rate, we now want a death rate that changes with population size. Assume that death rate will be equal to XXXXXXXXXXtimes the population density. Let’s call the parameter XXXXXXXXXXthe ‘density dependence death rate parameter’. (Introducing a density-dependent death rate creates a ‘bounded growth model’. See the hints in the R script for creating this model as well. And if you get stuck there are a couple of solutions as well.)
*What happens?
*Why is this model of population growth more realistic?
Note that the population tends towards a certain density that we can call the equili
ium population density.
*About how long does it take for the population to get close to its equili
ium population density?
*What happens if the initial population density is higher than the equili
ium population density?
*What happens if the initial population density is equal to the equili
ium population density? (Then set the initial population density back to what it was to start with.)
*What happens now if you increase the ‘reproduction rate’ parameter?
*What happens now if you decrease the ‘reproduction rate’ parameter?
*What happens if you change the ‘death rate’ to be XXXXXXXXXXtimes the population density instead of XXXXXXXXXXie change the ‘density dependence death rate parameter’ to be equal to 0.0002)?
*How does the equili
ium population density depend on the ‘reproduction rate’ parameter and the ‘density dependence death rate parameter’?? Can you write down an equation or give an explanation in words that actually gives the equili
ium population density as a function of the ‘reproduction rate’ parameter and the ‘density dependence death rate parameter’??
Now we want to do something similar but taking resource levels and consumption into account more explicitly, so we can start to think about competition. (For the mouse – the main limiting resource is food, edible seeds produced by plants in its environment).
We’ll create a new model, representing a situation where a small population of the mouse species colonises a new environment (an island perhaps). It is probably easiest to start by copying and pasting the code you wrote already (your model) and add a comment for yourself so you know this is the mouse competition model when you look back later. We are changing the time step for this new model – the time step is now days.
Add a new variable called ‘food’ – this is the biomass of edible seeds available (kg per square kilometre). Set the initial value for this variable to be 100.
This mouse needs at least 10g of food per day to just stay healthy. Within the loop, we can represent this by adding the following line of R code at the start of the { } block:
foodneeded = pop[time-1] * 0.01
The amount of food eaten on any day will depend on how much food the mouse finds – more mice will find more food, and if there is more food then more will be found. We can represent this with the following line of code:
foodeaten = food[time-1] * pop[time-1] * 0.001
* If the population was twice as big on a given day, and the amount of food was the same, what would happen to the amount of food eaten, according to this equation (note that this question is just checking to see if you understand the equation above – you don’t actually need to run or plot anything) ?
* If the population was twice as big, and the amount of food was also twice as big, what would happen to the amount of food eaten, according to this equation?
The amount of food left at the end of a day will be equal to the amount of food left at the end of the previous day, minus the amount of food eaten on this day. Add a line of code to represent this.
The growth rate of the population will be positive if the mouse finds more than enough food, zero if it finds just enough, and negative if it doesn’t find enough. Add the following line of code to represent this:
growthrate = 0.05 * (foodeaten - foodneeded)
The population at the end of a day should be the population at the end of the previous day, plus the change in population, and the change in population should be the population at the end of the previous day times the growth rate. Make sure that’s what your code is saying (there is no need for a death rate now, since the growth rate can be negative).
Run your new model over 365 days. Plot time against population, like before. Make sure the y-axis includes zero – you can do this by adding the option ylim=c(0,150) to the plot command. Add the food to the plot in red with the following command:
lines(1:maxtime , food,col='red',lwd=2,lty=2)
* What is happening on this island after the first mice a
ive. What happens to the mice and what happens to the food?
* For mice to survive and reproduce, they need to find mates and companions. This means there is an ‘Allee Effect’ – at small population densities, populations are no longer viable. We can represent this in a simple way by adding the following line of code at the end of the block:
if (pop[time]<3) pop[time]=0
* What is the minimum viable population density for this mouse?
* How long does it take for mice to die out completely? (You might need to extend the simulation.)
* If each mouse needs a little more food each day, does that make them die out earlier or later?
* If each mouse is a little better at finding food each day, does that make them die out earlier or later?
* If the growth rate is a little smaller, does that make them die out earlier or later?
* If the amount of food initially available is a little less than 100kg, does that make them die out earlier or later?
* What makes more difference to how long they last – halving the amount of food initially available, or doubling the initial population?
* Make sure you set all your parameter values back after changing them – have you done that?
Of course the grass on the island actually keeps on growing and producing seed. Each day the grass produces half a kilogram of edible seed. Make this change to the model.
* What is happening on this island after the first mice a
ive now? What happens to the mice and what happens to the food?
Now we want to model what happens if a second species of mouse colonises the island a year after the first one a
ives. To do this we need a new population variable (call it ‘pop2’). The initial population of the second species is zero, but at the end of day 365, some mice a
ive. Let’s say 60 a
ive, and the area of grassland on our island is 10 square kilometres, so on day 365 the population density of the new species jumps to 6. Include this in your model using an ‘if’ command.
At this point, run the model, and add another line to the output plot showing the density of the second species over time. You see it jump to 6 on day 365, then remain constant.
This second species eats the same seeds as the first one. It needs the same amount of seeds per day to just remain healthy. It is exactly as good at finding food, has the