The goal of indirectfacilitation is to …
You can install indirectfacilitation from github with:
# install.packages("devtools")
devtools::install_github("alaindanet/indirect_facilitation_model")
This is a basic example which shows you how to solve a common problem:
- Load the packages:
devtools::load_all()
library(simecol)
library(ggplot2)
library(tibble)
library(magrittr)
- Load the model and specify the parameters:
mod <- two_facilitation_model()
mod
# Show parameters:
parms(mod)
# Tweak parameters:
parms(mod)["g"] <- 0.2
parms(mod)["gamma1"] <- 0.10
parms(mod)["u"] <- 5
times(mod) <- c(from = 0, to = 1000, by = 1)
- Launch a simulation and plot the result:
mod_run <- sim(mod)
plotnp(mod_run)
- Fig 1: methods
- Add temporal dynamic CA + PA
- Fig 2: multi-states
- Add arrows
- Fig 3: bifurcation details
- Fig 4: Clustering cellular automata, C++ et Cnp
(f(\gamma, u)) and (f(\gamma, u))
- (Change space between panel)[tidyverse/ggplot2#2464 (comment)]
- (Change margin of the plot for plot_grid)[wilkelab/cowplot#31 (comment)]
- Fix B and E legend decrease a bit the lowest value (some points disapeared in fig B right panel, en haut à gauche)
- Run pair-approximation model with automated end of run
- Replace the file with
use_data()
- Clustering:
- plot NP
- plot (x2 - x1) / x1 for comparison CA/PA
- run CA for gradient facilitation/dispersion
- plot: separate lines (create groups: e.g: together & <
threshold, together & >= threshold, low_together …)
- Create groups
- Plot groups (linetype problem)
- Check if simulations have reached stability
- Implementation of a custom solver (“lsodar”)
- Test the implementation
- sim_multi():
- Save a simecol object
- Save a time argument
- Save init values
- Save baseline parameters
- Save param_combination
- param_combination: matrix of parameter combination
- be able to sim from a sim_multi object
- Generalize run_scenarii_gradient and run_2d_gradient:
f(b,g)
- check_param(model_spec, names(gradient)))
- Add check for argument conformity (check_param, check_inits) of valid starting values (scenario = “custom”), or a named list (provided by init_scenarii())
- Add methods: init.scenarii(), param.scenarii() (S4 methods) https://stackoverflow.com/questions/12100856/combining-s4-and-s3-methods-in-a-single-function
- See here
- Compare the effect of dispersal, facilitation strength, paturâge, aridité on clustering
- Document functions