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

minor corrections on simul functions

parent d1530079
No related branches found
No related tags found
No related merge requests found
......@@ -133,9 +133,9 @@ M3_WithDD_noDemoStoch <- function(N1, s, f, h, DD_params){
## M3_WithDD_noDemoStoch
# Extract DD parameters from list
rMAX = DD_params$rMAX
K = DD_params$K
theta = DD_params$theta
rMAX <- DD_params$rMAX
K <- DD_params$K
theta <- DD_params$theta
# Apply density dependence effect
lam_Nt <- 1 + rMAX*(1-(sum(N1)/K)^theta)
......@@ -208,9 +208,9 @@ M4_WithDD_WithDemoStoch <- function(N1, s, f, h, DD_params){
## M4_WithDD_WithDemoStoch
# Extract DD parameters from list
rMAX = DD_params$rMAX
K = DD_params$K
theta = DD_params$theta
rMAX <- DD_params$rMAX
K <- DD_params$K
theta <- DD_params$theta
# Apply density dependence effect
lam_Nt <- 1 + rMAX*(1-(sum(N1)/K)^theta)
......
......@@ -6,7 +6,7 @@
\usage{
run_simul(
nsim,
cumuated_impacts,
cumulated_impacts,
fatalities_mean,
fatalities_se,
onset_time,
......@@ -29,7 +29,7 @@ run_simul(
\arguments{
\item{nsim}{number of simulation}
\item{cumuated_impacts}{Logical. If TRUE, we used the projection model for cumulated impacts.}
\item{cumulated_impacts}{Logical. If TRUE, we used the projection model for cumulated impacts.}
\item{fatalities_mean}{a vector (numeric). Average number of fatalities, for each scenario.}
......@@ -111,7 +111,7 @@ carrying_capacity = 1200
theta = 1
rMAX_species <- 0.15
run_simul(nsim = 10, cumuated_impacts = FALSE,
run_simul(nsim = 10, cumulated_impacts = FALSE,
fatalities_mean, fatalities_se, onset_time = NULL,
pop_size_mean, pop_size_se, pop_size_type,
pop_growth_mean, pop_growth_se,
......
......@@ -8,7 +8,7 @@ the simulation progress bar in Shiny (incProgress function)}
\usage{
run_simul_shiny(
nsim,
cumuated_impacts,
cumulated_impacts,
fatalities_mean,
fatalities_se,
onset_time,
......@@ -31,7 +31,7 @@ run_simul_shiny(
\arguments{
\item{nsim}{number of simulation}
\item{cumuated_impacts}{Logical. If TRUE, we used the projection model for cumulated impacts.}
\item{cumulated_impacts}{Logical. If TRUE, we used the projection model for cumulated impacts.}
\item{fatalities_mean}{a vector (numeric). Average number of fatalities, for each scenario.}
......
rm(list = ls(all.names = TRUE))
graphics.off()
library(popbio)
## Libraries
library(eolpop)
......@@ -14,7 +14,7 @@ fatalities_se = c(0, 0.05, 0.05, 0.05)
pop_size_mean = 200
pop_size_se = 25
pop_growth_mean = 1
pop_growth_mean = 1.1
pop_growth_se = 0
survivals <- c(0.5, 0.7, 0.8, 0.95)
......@@ -23,8 +23,8 @@ fecundities <- c(0, 0, 0.05, 0.55)
model_demo = NULL # M2_noDD_WithDemoStoch #M1_noDD_noDemoStoch #M4_WithDD_WithDemoStoch #M3_WithDD_noDemoStoch #
time_horzion = 50
coeff_var_environ = 0.10
fatal_constant = "M"
pop_size_type = "Npair"
fatal_constant = "h"
pop_size_type = "Ntotal"
cumulated_impacts = TRUE
......@@ -60,7 +60,7 @@ vr_calibrated <- calibrate_params(inits = inits, f = fecundities, s = survivals,
s_calibrated <- head(vr_calibrated, length(survivals))
f_calibrated <- tail(vr_calibrated, length(fecundities))
build_Leslie(s = s_calibrated, f = f_calibrated) %>% lambda
lambda( build_Leslie(s = s_calibrated, f = f_calibrated) )
......@@ -84,16 +84,3 @@ names(run0)
N <- run0$N ; dim(N)
plot_traj(N, xlab = "Annee", ylab = "Taille de population (totale)")
abline(h = K)
colSums(N[,,,]) %>% max
plot_impact(N, onset_year = onset_year , xlab = "Annee", ylab = "Impact relatif")
N <- run0$N
output <- get_metrics(N, cumuated_impacts = cumulated_impacts)
output$scenario$Pext
#plot_impact(N = N, xlab = "year", ylab = "pop size")
#source("draws_histog.R")
#draws_histog(draws = run0$lambdas, mu = pop_growth_mean, se = pop_growth_se)
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