# NOT RUN {
set.seed(1)
w_plans <- list()
w_plans[[1]] <- c(5, 1000, 5, 1000, 5, 5, 1000, 5, 1000, 5)
w_plans[[2]] <- c(5, 5, 5, 1000, 1000, 1000, 1000, 5, 5, 5)
w_plans[[3]] <- c(rep(1000, 4), rep(5, 6))
w_plans[[4]] <- rev(w_plans[[3]])
plans_name_sp <- c("Full range of responses", "Most stable only",
"Lower half", "Upper half")
n_trials <- 50 # number of trials at each n conservation plan
n_plans <- 4 # number of plans
num_pops <- c(2, 4, 8, 16) # n pops to conserve
w <- list()
for(i in 1:n_plans) { # loop over number conserved
w[[i]] <- list()
for(j in 1:n_trials) { # loop over trials
w[[i]][[j]] <- matrix(rep(625, 16), nrow = 1)
w[[i]][[j]][-sample(1:16, num_pops[i])] <- 5
}
}
arma_env_params <- list(mean_value = 16, ar = 0.1, sigma_env = 2, ma = 0)
x_arma_sp <- run_cons_plans(w, env_type = "arma", env_params = arma_env_params)
plot_cons_plans(x_arma_sp$plans_mv, plans_name = plans_name_sp, cols =
cols, add_all_efs = FALSE, xlim = c(0.02, 0.15), ylim = c(-0.017,
0.017), add_legend = FALSE)
# In this version, the pops are wiped out; total abundance changes
n_trials <- 50 # number of trials at each n conservation plan
num_pops <- c(2, 4, 8, 16) # n pops to conserve
n_plans <- length(num_pops) # number of plans
w <- list()
for(i in 1:n_plans) { # loop over number conserved
w[[i]] <- list()
for(j in 1:n_trials) { # loop over trials
w[[i]][[j]] <- matrix(rep(1000, 16), nrow = 1)
w[[i]][[j]][-sample(1:16, num_pops[i])] <- 5
}
}
plans_name_n <- paste(num_pops, "populations")
arma_env_params <- list(mean_value = 16, ar = 0.1, sigma_env = 2, ma = 0)
x_arma_n <- run_cons_plans(w, env_type = "arma", env_params =
arma_env_params, max_a = thermal_integration(16))
plot_cons_plans(x_arma_n$plans_mv, plans_name = plans_name_n, cols =
cols, add_all_efs = FALSE, xlim = c(0.02, 0.15), ylim = c(-0.017,
0.017), add_legend = FALSE)
# }
Run the code above in your browser using DataLab