This vignette illustrates the basic use of demovuln.
We define a simple two-stage projection matrix. Columns are source
stages at time t, and rows are destination stages at time
t + 1.
A <- matrix(
c(0.0, 0.4,
2.0, 0.7),
nrow = 2,
byrow = FALSE
)
A
#> [,1] [,2]
#> [1,] 0.0 2.0
#> [2,] 0.4 0.7We simulate a perturbation affecting adult survival.
sim <- simulate_dynamics(
model,
target = "adult_survival",
magnitude = 0.25,
duration = 1,
period = 3,
t_max = 50,
recovery_steps = 10
)
sim$reduction
#> [1] 95.95533plot(
sim$baseline_abundance,
type = "l",
lwd = 2,
xlab = "Time step",
ylab = "Relative population size",
ylim = range(c(sim$baseline_abundance, sim$abundance))
)
lines(sim$abundance, lwd = 2, lty = 2)
legend(
"topright",
legend = c("Baseline", "Perturbed"),
lty = c(1, 2),
lwd = 2,
bty = "n"
)