Modelo UPCA. Aplicación en R (paquete simecol)

Modelo UPCA


##The constant period-chaotic amplitude (UPCA) model (Lotka-Volterra-type model). The model consists of three equations for resource u, herbivorous v, and carnivorous w animals.
#du/dt= au -1 f1(u, v) (1),dv/dt= -bv +1 f1(u, v) -2 f2(v, w) (2),dw/dt= -c(w - w ) +2 f2(v, w) (3). where f1, f2 represent either the Lotka-Volterra term fi(x, y) = xy or the Holling type II term fi(x, y) = xy/(1 + kix) and w is an important stabilizing minimum predator level when the prey population is rare.
library("simecol")
f <- function(x, y, k){x*y / (1+k*x)} # Holling II
upca <- new("odeModel", main = function(time, y, parms)
{
with(as.list(c(parms, y)),
{
du <- a * u - alpha1 * f(u, v, k1)
dv <- -b * v + alpha1 * f(u, v, k1) +
- alpha2 * f(v, w, k2)
dw <- -c * (w - wstar) + alpha2 * f(v, w, k2)
list(c(du, dv, dw))
})
},
times = seq(0, 100, 0.1),
parms = c(a=1, b=1, c=10, alpha1=0.2, alpha2=1,k1=0.05, k2=0, wstar=0.006),
init = c(u=10, v=5, w=0.1),
solver = "lsoda"
)


upca <- sim(upca)
plot(upca)
plotupca <- function(obj, ...)
{
o <- out(obj)
matplot(o[, 1], o[, -1], type = "l", ...)
legend("topright", legend = c("u", "v", "w"), lty = 1:3, , bg = "white", col = 1:3)
}
plotupca(upca)

sc1 <- sc2 <- upca #crear escenarios
parms(sc1)["wstar"] <- 0; parms(sc2)["wstar"] <- 0.1
sc1 <- sim(sc1); sc2 <- sim(sc2)
par(mfrow = c(1, 2)); plotupca(sc1, ylim = c(0, 250)); plotupca(sc2, ylim = c(0, 250))

f <- function(x, y, k) { x * y } #cambiamos la respuesta funcional f de Holling II a Lotka-Volterra
sc1 <- sim(sc1); sc2 <- sim(sc2)
par(mfrow = c(1, 2)); plotupca(sc1, ylim = c(0, 20)); plotupca(sc2, ylim = c(0, 20))

sc1 <- sc2 <- upca #we derive two new clones with default parameter settings from the original upca-object, and then assign one version (the Holling II functional response) to scenario 1 and the other version (simple multiplicative Lotka-Volterra functional response) to scenario 2 (figure 1.4):
equations(sc1)$f <- function(x, y, k) { x * y/(1 + k * x) }
equations(sc2)$f <- function(x, y, k) { x * y }
sc1 <- sim(sc1); sc2 <- sim(sc2)
par(mfrow = c(1, 2)); plotupca(sc1, ylim = c(0, 20)); plotupca(sc2, ylim = c(0, 20))

Created by Pretty R at inside-R.org

Comentarios