2015-02-11 82 views
0

我试图创建中的R图形显示利用给我一个例子是人口的承载能力:密度依赖性生长

install.packages("deSolve", dependencies = TRUE) 

clogistic <- function(times, y, parms){ 
n <- y[1] 
r <- parms[1] 
alpha <- parms [2] 
dN.dt <- r * n * (1 - alpha * n) 
return(list(c(dN.dt))) 
} 

prms <- c(r = 1, alpha = 0.01) 
init.N <- c(1) 
t.s <- seq(0.1, 10, by = 0.1) 
library(deSolve) 
out <- ode(y = init.N, times = t.s, clogistic, parms = prms) 

plot(out[,1], out[,2], type="l", xlab = "Time", ylab = "N", col = "blue", lwd = 2) 

现在,我使用这个尝试和表演初始人口178人,15个时间步长增加21人。但是当我尝试改变公式时,它会在一个时间步后减少并下降,并在剩下的时间内保持底部。 我试着改变init.N < - c(1)到c(178),它的确如此,但随后变得暗淡无光。我尝试将cms(r = 1,alpha = 0.01)改为(r = 21),同时改变初始人口变化,但没有增加,我错过了什么?了解R使得将是小东西,但我只是不停地失踪了 任何帮助,将不胜感激

+0

跟进@ BondedDust的回答是:逻辑方程的更常见的形式在生态学中是'r * n *(1-n/K)',其中'K'是承载能力(=只要r> 0,稳定平衡值,K> 0,n(0) > 0')。这可能会使事情更容易理解。 – 2015-02-11 20:52:00

回答

2

这是一个集成差分方程:。

dN.dt <- r * n * (1 - alpha * n) 

如果你想的渐近线n = 200然后将alpha设置为1/200,以便当n变为200时,变化率将变为零:

prms <- c(r = 1, alpha = .005) 
init.N <- 178 
t.s <- seq(0.1, 10, by = 0.1) 
library(deSolve) 
out <- ode(y = init.N, times = t.s, clogistic, parms = prms) 

plot(out[,1], out[,2], type="l", xlab = "Time", ylab = "N", col = "blue", lwd = 2) 

enter image description here

随着178起始值,变化率将是负的当α大于一百七十八分之一时,将用α==一百七十八分之一FLATLINE,并且将物流当α少比1/178。

要转到从300到200,你会不断的α= 1/200,并在300开始:

prms <- c(r = 1, alpha = 1/200) 
init.N <- c(300) 
t.s <- seq(0.1, 10, by = 0.1) 
out <- ode(y = init.N, times = t.s, clogistic, parms = prms) 
plot(out[,1], out[,2], type="l", xlab = "Time", ylab = "N", col = "blue", lwd = 2) 

enter image description here