# Logistic Growth Model with R

Models like the discrete logistic growth model are famous for producing complex behaviour from simple equations. You can cut and paste the R script provided below onto the R command line, to produce a graph like the one given Figure 1. Try varying the parameter r to see what happens; for example, to set the parameter r to 1.5, enter the following:

> LogisticGrowthExample( r = 1.5 );

References

Logistic Equation. Wolfram Mathworld: mathworld.wolfram.com/LogisticEquation.html
Logistic Map. Wikipedia: en.wikipedia.org/wiki/Logistic_map

R Script

#NOTE: You will need to replace the right and left quotation marks with
#straight quotes before running this script in R.

LogisticGrowthExample <- function(r = 3.7, N0 = 0.1, steps = 100){
#Implemention by Allan Roberts, March 2013.

N <- numeric(steps);
N <- N0; #the initial population

Next <- function(N) {N <-  N + (r-1)*N*(1-N)};
for (i in 2:(steps)) N[i] <- Next(N[i-1]);

plot(N~seq(0,(steps-1)),type=”l”,xlab=quote(time), ylim=c(0,1.5), las = 1 );
title(main=”Discrete Logistic Growth Model”, font.main=1, cex.main=2);