Tanggal :September 22, 2020

R32. Logistic Growth in R

Spread the love

Logistic growth of fisheries, or other populations, will go towards a Carrying Capacity. The growth will start exponentially and is S-shaped.

For a specific rate of growth, and Carrying Capacity, the Population is shown.

The vertical line shows the maximum derivative, that is where the maximum growth occurs.


# ex32.R
library(nnet)
r <- .25 # growth rate / yr
K <- 100 # carrying capacity
t <- 40 # number of years
num <- numeric(t+1)
num[1] <- 1
for (i in 1:t) {
num[i+1] <- num[i]+r*num[i]*(1-num[i]/K)
}
plot(num, type = 'l', col = 'blue',
xlab = 'Year', ylab = 'Number',
main = "Growth rate: 0.25, Carrying Capacity = 100")
abline(v=which.is.max(diff(num)))

Output:

Share

Leave a Reply

Your email address will not be published. Required fields are marked *