plotCobweb | R Documentation |
Cobweb plots for logistic, Ricker, Gompertz, or theta-logistic models.
plotCobweb(modeloutput, modelname, modelpars, viewcode = FALSE)
modeloutput |
an array of population sizes at time "t" generated by a discrete time model. Equivalent to "output" used in Section 14.1.2 |
modelname |
character string indicating model used: "logistic", "ricker", "gompertz", "theta-logistic" |
modelpars |
a list containing model parameters. For logistic, this will be list(r = r, K = K). For ricker, use list(alphal = alphal, K = K). For gompertz, use list(b = b, K = K). For theta-logistic, use list(r = r, K = K, theta = theta) |
viewcode |
TRUE or FALSE (default) indicating whether to print the function code |
a cobweb plot in the figure window
#Logistic Equation:
r <- 1.5
K <- 100
N0 <- 10
tmax <- 50
years <- 0:tmax
output <- rep(x = NA, times = length(years))
output[1] <- N0
n.loop <- length(years)
for (i in 2:n.loop) {
n.t <- output[i-1]
n.t.plus.1 <- n.t + r * n.t * (1 - n.t / K)
output[i] <- n.t.plus.1
}
plotCobweb(modeloutput = output, modelpars = list(r = r, K = K), modelname = "logistic")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.