Here the problem numbers refer to the chapter numbers in the book.
4.1. The “integrated form” is the same as a solution to the logistic model.
4.2. Please comment on the difference between 4.1. and 4.2., and make sure to check in with your guts/intuition before and after.
4.3. No additional comments aside from use
ode(..., method = "iteration")
this time.
4.4. I’ve done this problem for you, without arrows.
# Load package deSolve
library(package = "deSolve")
# Function
PV_disc <- function(t, state, parms) {
with(as.list(c(state, parms)), {
Vt1 <- b*V*((K - V) / K)*exp(-a*P)
Pt1 <- c*V*(1 - exp(-a*P))
return(list(c(Vt1, Pt1)))
})
}
# Parameters
parm_vec <- c(b = 1.5, K = 40, a = 0.1, c = 1.5)
# Simulation conditions
steps_vec <- seq(from = 0, to = 200, by = 1)
init_Ns <- c(V = 12.18, P = 0.06)
# Simulation (discrete time, so method = iteration)
odeOut_4.4 <- ode(y = init_Ns, times = steps_vec, func = PV_disc, parms = parm_vec, method = "iteration")
# Plot results
par(mfrow = c(1, 2), mar = c(4.5, 4.5, 0.5, 0.5))
# Time series
plot(x = steps_vec, y = odeOut_4.4[,2], type = "l", col = "blue", xlab = "Step", ylab = "Abundance", ylim = c(0, max(odeOut_4.4[,2:3])), las = 1)
points(x = steps_vec, y = odeOut_4.4[,2], pch = 16, col = "blue", cex = 0.5)
lines(x = steps_vec, y = odeOut_4.4[,3], col = "red")
points(x = steps_vec, y = odeOut_4.4[,3], pch = 16, col = "red", cex = 0.5)
# State space
plot(x = odeOut_4.4[,2], y = odeOut_4.4[,3], type = "l", xlab = "Prey abundance", ylab = "Predator abundance", las = 1)
points(x = odeOut_4.4[,2], y = odeOut_4.4[,3], pch = 16, col = "black", cex = 0.5)
4.5. Same as 4.4, but change the formula and parameter values. For
initial conditions, use densities of
init.Ns <- c(V = 1.996, P = 0.125)
4.9. No additional comments.