Skip to contents

Installation and setup

library(roleR)
set.seed(1)

Components of a roleModel workflow

Basic workflow


# set-up parameters
p <- roleParams(
  individuals_local = 1000,
  individuals_meta = 10000,
  species_meta = 50,
  speciation_local = 0.5,
  speciation_meta = 1,
  extinction_meta = 0.8,
  trait_sigma = 2,
  env_sigma = 1,
  comp_sigma = 1,
  dispersal_prob = 0.5,
  mutation_rate = 0.01,
  equilib_escape = 1,
  num_basepairs = 250,
  init_type = 'oceanic_island',
  niter = 1000,
  niterTimestep = 100
)

# initialize the model
m <- roleModel(p)

# run the model
m <- runRole(m)

# get results
getSumStats(m, list(rich = richness, hill = hillAbund))
#>    rich    hill_1   hill_2   hill_3   hill_4 iteration
#> 1     1  1.000000 1.000000 1.000000 1.000000         0
#> 2    59  1.656612 1.146187 1.107847 1.095311       100
#> 3   107  2.705495 1.335870 1.243011 1.213329       200
#> 4   147  4.016277 1.533888 1.379389 1.330971       300
#> 5   182  5.788284 1.773811 1.539565 1.467523       400
#> 6   228  8.843362 2.099596 1.748452 1.643264       500
#> 7   251 11.617615 2.385382 1.925853 1.790699       600
#> 8   275 15.344688 2.768105 2.156793 1.980445       700
#> 9   294 18.808192 3.103778 2.354183 2.140912       800
#> 10  316 23.610005 3.531897 2.598321 2.337333       900
#> 11  335 28.581941 4.017194 2.870130 2.553785      1000

Setting parameters

Initializing a roleModel

Running a roleModel

RoLE Experiments

Calculating summary statistics

Analyzing output (machine learning?)