Skip to content
Snippets Groups Projects
Commit 3e583d67 authored by thierrychambert's avatar thierrychambert
Browse files

run_simul : new version of DD (balancing theta and rMAX)

parent 1687577b
No related branches found
No related tags found
No related merge requests found
...@@ -188,12 +188,7 @@ model_demo = NULL ...@@ -188,12 +188,7 @@ model_demo = NULL
# GROWING population... # GROWING population...
if(lam_it[sim] > 1){ if(lam_it[sim] > 1){
# Calculate rMAX (and theta if needed)
# Extract rMAX
new_rMAX <- infer_rMAX(K = K, theta = theta, new_rMAX <- infer_rMAX(K = K, theta = theta,
pop_size_current = sum(N0), pop_growth_current = lam_it[sim], pop_size_current = sum(N0), pop_growth_current = lam_it[sim],
rMAX_theoretical = Inf) rMAX_theoretical = Inf)
......
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
#' It can thus be expressed as the total population or the number of pair. #' It can thus be expressed as the total population or the number of pair.
#' @param carrying_capacity_se Standard Error for the carrying capacity. #' @param carrying_capacity_se Standard Error for the carrying capacity.
#' #'
#' @param theta a strictly positive number. Parameter defining the shape of the density-dependence relationship. #' @param theta NOT implemented.
#' a strictly positive number. Parameter defining the shape of the density-dependence relationship.
#' The relationship is defined as : r <- rMAX*(1-(N/K)^theta) #' The relationship is defined as : r <- rMAX*(1-(N/K)^theta)
#' Note lambda = r + 1 #' Note lambda = r + 1
#' #'
...@@ -59,7 +60,7 @@ run_simul_shiny <- function(nsim, cumulated_impacts, ...@@ -59,7 +60,7 @@ run_simul_shiny <- function(nsim, cumulated_impacts,
pop_growth_mean, pop_growth_se, pop_growth_mean, pop_growth_se,
survivals, fecundities, survivals, fecundities,
carrying_capacity_mean, carrying_capacity_se, carrying_capacity_mean, carrying_capacity_se,
theta = 1, rMAX_species, theta = NULL, rMAX_species,
model_demo = NULL, time_horizon, coeff_var_environ, fatal_constant){ model_demo = NULL, time_horizon, coeff_var_environ, fatal_constant){
...@@ -68,8 +69,8 @@ run_simul_shiny <- function(nsim, cumulated_impacts, ...@@ -68,8 +69,8 @@ run_simul_shiny <- function(nsim, cumulated_impacts,
# Fill the list of DD parameters # Fill the list of DD parameters
DD_params$K <- NULL DD_params$K <- NULL
DD_params$theta <- theta DD_params$theta <- NULL
DD_params$rMAX <- rMAX_species DD_params$rMAX <- NULL
# Number of years # Number of years
nyr <- time_horizon nyr <- time_horizon
...@@ -163,10 +164,23 @@ run_simul_shiny <- function(nsim, cumulated_impacts, ...@@ -163,10 +164,23 @@ run_simul_shiny <- function(nsim, cumulated_impacts,
# GROWING population... # GROWING population...
if(lam_it[sim] > 1){ if(lam_it[sim] > 1){
# Extract rMAX # Calculate rMAX (and theta if needed)
DD_params$rMAX <- infer_rMAX(K = K, theta = theta, new_rMAX <- infer_rMAX(K = K, theta = theta,
pop_size_current = sum(N0), pop_growth_current = lam_it[sim], pop_size_current = sum(N0), pop_growth_current = lam_it[sim],
rMAX_theoretical = rMAX_species) rMAX_theoretical = Inf)
if(new_rMAX <= rMAX_species){
DD_params$rMAX <- new_rMAX
}else{
# Infer theta
DD_params$rMAX <- rMAX_species
DD_params$theta <- infer_theta(K = K,
pop_size_current = sum(N0), pop_growth_current = lam_it[sim],
rMAX = rMAX_species)
}
# ... and initially LARGE population # ... and initially LARGE population
if(sum(N0) > 500) model_demo <- M3_WithDD_noDemoStoch if(sum(N0) > 500) model_demo <- M3_WithDD_noDemoStoch
......
...@@ -9,7 +9,7 @@ library(eolpop) ...@@ -9,7 +9,7 @@ library(eolpop)
## Inputs ## Inputs
nsim = 3 nsim = 3
pop_size_mean = 30000 pop_size_mean = 12000
pop_size_se = 0 pop_size_se = 0
pop_size_type = "Ntotal" pop_size_type = "Ntotal"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment