Code for Pathways to Cultural Adaptation manuscript
The following files are found in the model/
folder
run.jl
initiates julia simulations after loading methods frommethods.jl
and the job array specific parameters frommain.jl
summariseFiles_rout.R
opens all*.Rdata
files from the output directory, summarises values, and returns a summary file into the working directory (with the current setting it will create three files one with a general summary, one with a record of all the individual repertoires, and one with all the time series data)
The figures/
folder contains R
code to generate the figures of the main text.
The material/
folder contains supplemental material.
Running the simulation code requires:
julia
(dependencies:Distributions
,StatsBase
,Random
,RCall
); tested and verified for Julia version 1.8.5r
(dependencies: igraph)
In our manuscript, Pathways to Cultural Adaptation, we report results for the following versions of the model:
- Homogeneous environments, evolving
$p_n$ ,$p_r$ - Homogeneous environments, evolving
$p_n$ ,$p_r$ , variable innovation and social learning success rate - Heterogeneous environments, evolving
$p_n$ ,$p_r$ - Heterogeneous environments, evolving
$p_n$ ,$p_r$ , variable population size
Furthermore, in the ESM we report results for simulations with
- Neutral selection
- Fixed linking parameters
- Random graphs
- Simple Contagion
- Fertility selection
To run the individual simulations you need to:
- Adjust the parameters in the
grid
array that is defined inmain.jl
. - Adjust the number of simulations accordingly in line 15 of
run.jl
(e.g. if you changedgrid
so that there will be in total 100 simulations, line 15 should readfor q in 1:100
)
For homogeneous environments, set parameters 11 (
To let true
. In this case, you might want to initialise the population with random values for 1000
. To keep false
.
Learning success rates
Population size can be adjusted by changing parameter 1.
How selection works is determined by parameter 17, whereby 1
indicates mortality selection, 0
indicates neutral selection, and -1
indicates fertility selection.
The mode of social learning contagion is controlled by parameter 15, whereby true
indicates complex contagion, and false
indicates simple contagion.
To simulate learning on random graphs, set parameter 8 to -1
(which sets up a fully connected network), and adjust parameter 14, which controls the number of randomly selected neighbours an individual can learn from,
The minimum fitness can be adjusted with parameter 16. And saturating payoffs (Michaelis-Menten model) can be turned on or off with parameter 18.
In the main text of our manuscript Pathways to Cultural Adaptation, we report on populations cycling between the high connectivity state (with high payoffs) and sparse networks (with low payoffs).
Here is an example of this pattern:
When looking at several simulations across time, we observe how there both pathways present (low payoff and high payoff) throughout the simulaitons: