maysingle = function(r,k,noise, n0,nostep){ #calculates one time series of the May's equation #r - growth rate #k - carrying capacity #n0 - initial population size #nostep - number of steps for simulation #noise - absolute noise n = rep(NA,nostep+1) n[1] = n0 for (t in 1:nostep) { nprime = r*n[t]*(k-n[t])/k + rnorm(1,0,noise)*n[t] if (nprime < 0) nprime = 0; n[t+1] = nprime } n }