Question: This exercise is designed to develop a stochastic modeling approach to population dynamics. Unlike our earlier population models, which were deterministic in nature, this approach
This exercise is designed to develop a stochastic modeling approach to population dynamics. Unlike our earlier population models, which were deterministic in nature, this approach treats population events like births and deaths as stochastic events. Whether an individual in the population gives birth to another organism or dies in some given time period is based on the probabilities of these events. Therefore at the level of the individual, birth and death events have an associated randomness and unpredictability. However as you will see, this does not preclude the existence of a certain degree of predictability, particularly for large groups of organisms.
For this exercise, you will be developing a computer program that carries out the specific example in Exercise on page of the Keen & Spain text. Initially, use a slightly greater value for the birth coefficient than the death coefficient b d You should start with a population size of and run the model for generations. When you get the program working, run it different times and plot your results population size versus generation You should also draw a graph or use the same graph of the average population size average the results of all runs for each time step The model is stochastic and so you should get different results sometimes very different for each run.
Next, make another set of runs, but reverse the values for the birth and death rate coefficients b and d Produce a similar graph as described in the previous paragraph.
The text for Exercise indicates that a plot of log population size versus time should be linear and you may plot your data this way if you choose, but a simple plot of population size versus time is entirely acceptable.
For the Conclusions section of your report, think about how your results compare to the behavior demonstrated by some of our earlier deterministic population models. Also, think about the behavior of an individual population run as compared to the average of many runs. Are the results sensitive to small differences in those rate coefficients?
help me add a loop so i can get all runs in oneimport random
import matplotlib.pyplot as plt
# birth and death rates
b
d
# pop size
popsize
# number of generations
numgenerations
popsizes
avgpopsizes
pbirth b d
pdeath d b
# generate randomness
for i in rangenumgenerations:
for org in range popsize:
if random.uniform pbirth:
popsize
if pbirth random.uniformpdeath pbirth :
popsize
popsizes.appendpopsize
avgpopsize sumpopsizes lenpopsizes
avgpopsizes.appendavgpopsize
# Plot pop sizes and avg pop sizes
pltplotpopsizes
pltplotavgpopsizes
pltxlabelGeneration
pltylabelPopulation
pltlegendPop Size', 'Average Pop Size'
pltshow
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
