Week 3 - Logistic population growth and stability analysis
Credit to Gen-Chang Hsu
Extra materials - Modeling discrete logistic models using for loops
Model: \[ N_{t+1} = N_t(1+r(1-\frac{N_t}{K})) \]
You may modify \(r\) to see the change in stability of equilibrium \(K\).
### (2) Set the parameters
r <- 1.8
K <- 500
N0 <- 10
time <- 100
### (3) Use for loop to iterate over the time sequence
pop_size <- data.frame(times = 1:time)
pop_size$N[1] <- N0
head(pop_size)
## times N
## 1 1 10
## 2 2 10
## 3 3 10
## 4 4 10
## 5 5 10
## 6 6 10
## times N
## 1 1 10.00000
## 2 2 27.64000
## 3 3 74.64171
## 4 4 188.93980
## 5 5 400.51775
## 6 6 543.95762
### (4) Population trajectory
plot(N ~ times, data = pop_size, type = "l")
abline(h = K, col = "red")
points(N ~ times, data = pop_size)
Here is a shiny app for the discrete logistic growth model.
Credit to Gen-Chang Hsu