Answer To: Please refer to the attached word document for instructions.
Himanshu answered on Aug 26 2022
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/revision 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.
Question: What do you notice?
Answer: The relationship between time and density looks linear, i.e. as time increases the density increases using a straight line which is evident from the plot.
growthrate = 0.1; pop = 5; maxtime = 5
for (time in 2:maxtime){
pop[time] = pop[time-1] + growthrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple')
Look at the formula
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).
Question: What happens when you increase the reproduction rate?
Answer: As the reproduction rate increases from 0.1 to 0.5, the relationship cannot be represented using a straight line.
growthrate = 0.5; pop = 5; maxtime = 5
for (time in 2:maxtime){
pop[time] = pop[time-1] + growthrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple')
In more mathematical notation this equation could be written as:
Now extend the model to time = 100. Also extend the graph to time = 100.
Question: What do you see now?
Answer: There is a sudden increase in population density after time 85.
growthrate = 0.5; pop = 5; maxtime = 100
for (time in 2:maxtime){
pop[time] = pop[time-1] + growthrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple')
Question: What happens if you reduce the reproduction rate?
Answer: There is an exponential increase in population density from time = 40.
growthrate = 0.1; pop = 5; maxtime = 100
for (time in 2:maxtime){
pop[time] = pop[time-1] + growthrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple')
Question: Why is this not a realistic model of population growth?
Answer: This model does not account for deaths. A model which may consider deathrate along with growthrate would be more realistic.
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.
Question: Adapt the equation to account for this death rate as well as the reproduction (birth) rate. What happens?
Answer: There is an exponential increase in population density but the rate of increase has decreased with respect to the previous example.
deathrate = 0.05; growthrate = 0.1; pop = 5; maxtime = 100
for (time in 2:maxtime){
pop[time] = pop[time-1] + growthrate * pop[time-1] - deathrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple')
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 0.0001 times the population density. Let’s call the parameter 0.0001 the ‘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.)
Question: What happens?
Answer: The population increases with time and becomes constant at a population density of 1000.
DDDRP = 0.0001; pop = 5; growthrate = 0.1; maxtime = 200
for (time in 2:maxtime){
deathrate = DDDRP * pop[time-1]
pop[time] = pop[time-1] + growthrate * pop[time-1] - deathrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple')
Question: Why is this model of population growth more realistic?
Answer: This model considers both growthrate and deathrate unlike the unbounded population model. Also the deathrate is propotional to the population density, which is eveident from real world also
Note that the population tends towards a certain density that we can call the equilibrium population density.
Question: About how long does it take for the population to get close to its equilibrium population density?
Answer: In the previous example, it took almost 100 years to reach the equilibrium.
Question: What happens if the initial population density is higher than the equilibrium population density?
DDDRP = 0.0001; pop = 2000; growthrate = 0.1; maxtime = 500
for (time in 2:maxtime){
deathrate = DDDRP * pop[time-1]
pop[time] = pop[time-1] + growthrate * pop[time-1] - deathrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple')
Answer: The population density decreases exponentially to the equilibrium population density of 1000.
Question: What happens if the initial population density is equal to the equilibrium population density?
DDDRP = 0.0001; pop = 1000; growthrate = 0.1; maxtime = 500
for (time in 2:maxtime){
deathrate = DDDRP * pop[time-1]
pop[time] = pop[time-1] + growthrate * pop[time-1] - deathrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple')
Answer: The population density remains constant through time.
Question: What happens now if you increase the ‘reproduction rate’ parameter?
DDDRP = 0.0001; pop = 1000; growthrate = 0.5; maxtime = 500
for (time in 2:maxtime){
deathrate = DDDRP * pop[time-1]
pop[time] = pop[time-1] + growthrate * pop[time-1] - deathrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple')
Answer: The population density attains equllibrium at 5000.
Question: What happens now if you decrease the ‘reproduction rate’ parameter?
DDDRP = 0.0001; pop = 10; growthrate = 0.05; maxtime = 500
for (time in 2:maxtime){
deathrate = DDDRP * pop[time-1]
pop[time] = pop[time-1] + growthrate * pop[time-1] - deathrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple')
Answer: The population density attains equillibrium at 500 very slowly.
Question: What happens if you change the ‘death rate’ to be 0.0002 times the population density instead of 0.0001 (ie change the ‘density dependence death rate parameter’ to be equal to 0.0002)?
DDDRP = 0.0002; pop = 1000; growthrate = 0.05; maxtime = 500
for (time in 2:maxtime){
deathrate = DDDRP * pop[time-1]
pop[time] = pop[time-1] + growthrate * pop[time-1] - deathrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple')
pop[maxtime]
## [1] 250
Answer: The population density attains equillibrium at 250.
Question: How does the equilibrium 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 equilibrium population density as a function of the ‘reproduction rate’ parameter and the ‘density dependence death rate parameter’?
Answer:
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:
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:
Question: 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)?
Answer: When the population is doubled, the amount of food eaten also multiplies by 2.
food = 100; pop = 5;
foodneeded = pop * 0.01; foodneeded
## [1] 0.05
foodeaten = food * pop * 0.001; foodeaten
## [1] 0.5
pop = 10
foodneeded = pop * 0.01; foodneeded
## [1] 0.1
foodeaten = food * pop * 0.001; foodeaten
## [1] 1
Question: 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?
food = 200; pop = 10
foodneeded = pop * 0.01; foodneeded
## [1] 0.1
foodeaten = food * pop * 0.001; foodeaten
## [1] 2
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:
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:
food = 100; pop = 5; maxtime = 365
for (time in 2:maxtime){
foodneeded = pop[time-1] * 0.01
foodeaten = food[time-1] * pop[time-1] * 0.001
food[time] = food[time-1] - foodeaten
growthrate = 0.05 * (foodeaten - foodneeded)
pop[time] = pop[time-1] + growthrate * pop[time-1]
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple', ylim = c(0,150))
lines(1:maxtime, food, col = 2, lwd = 2, lty = 2)
Question: What is happening on this island after the first mice arrive. What happens to the mice and what happens to the food?
Answer: The mice population increases exponentially to a point where there is no food left. After that, the mice population decreases very rapidly.
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:
food = 100; pop = 5; maxtime = 1000
for (time in 2:maxtime){
foodneeded = pop[time-1] * 0.01
foodeaten = food[time-1] * pop[time-1] * 0.001
food[time] = food[time-1] - foodeaten
growthrate = 0.05 * (foodeaten - foodneeded)
pop[time] = pop[time-1] + growthrate * pop[time-1]
if(pop[time]<3) {pop[time] = 0}
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple', ylim = c(0,150))
lines(1:maxtime, food, col = 2, lwd = 2, lty = 2)
Question: What is the minimum viable population density for this mouse?
Answer: 135
max(pop)
## [1] 134.963
Question: How long does it take for mice to die out completely?
Answer: time = 729
which(pop==0)[1]
## [1] 729
Question: If each mouse needs a little more food each day, does that make them die out earlier or later?
Answer: Later
Question: If each mouse is a little better at finding food each day, does that make them die out earlier or later?
Answer: Later
Question: If the growth rate is a little smaller, does that make them die out earlier or later?
Answer: Earlier
Question: If the amount of food initially available is a little less than 100kg, does that make them die out earlier or later?
Answer: Earlier
Question: What makes more difference to how long they last – halving the amount of food initially available, or doubling the initial population?
Answer: Doubling the initial population since population extincts quicker than halving the food.
# Halving the Food
food = 50; pop = 5; maxtime = 1000
for (time in 2:maxtime){
foodneeded = pop[time-1] * 0.01
foodeaten = food[time-1] * pop[time-1] * 0.001
food[time] = food[time-1] - foodeaten
growthrate = 0.05 * (foodeaten - foodneeded)
pop[time] = pop[time-1] + growthrate * pop[time-1]
if(pop[time]<3) {pop[time] = 0}
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple', ylim = c(0,150))
lines(1:maxtime, food, col = 2, lwd = 2, lty = 2)
# Double the Population
food = 100; pop = 10; maxtime = 1000
for (time in 2:maxtime){
foodneeded = pop[time-1] * 0.01
foodeaten = food[time-1] * pop[time-1] * 0.001
food[time] = food[time-1] - foodeaten
growthrate = 0.05 * (foodeaten - foodneeded)
pop[time] = pop[time-1] + growthrate * pop[time-1]
if(pop[time]<3) {pop[time] = 0}
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple', ylim = c(0,150))
lines(1:maxtime, food, col = 2, lwd = 2, lty = 2)
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.
food = 100; pop = 5; maxtime = 365
for (time in 2:maxtime){
foodneeded = pop[time-1] * 0.01
foodeaten = food[time-1] * pop[time-1] * 0.001
food[time] = food[time-1] - foodeaten + 0.5
growthrate = 0.05 * (foodeaten - foodneeded)
pop[time] = pop[time-1] + growthrate * pop[time-1]
if(pop[time]<3) {pop[time] = 0}
}
plot(1:maxtime , pop, type = 'l' , xlab = 'time', ylab = 'population density', lwd = 2, lty = 3, col = 'purple', ylim = c(0,500))
lines(1:maxtime, food, col = 2, lwd = 2, lty = 2)
Question: What is happening on this island after the first mice arrive now? What happens to the mice and what happens to the food?
Answer: The population extincts later than the one without the seed case. The food finished slowly.
Now we want to model what happens if a second species of mouse...