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    51  1.616558 1.143665 1.106069 1.093749       100
#> 3    95  2.538301 1.317391 1.230188 1.202197       200
#> 4   140  3.898818 1.522533 1.371732 1.324402       300
#> 5   179  6.039233 1.816385 1.567679 1.491336       400
#> 6   213  8.298739 2.079305 1.737026 1.633769       500
#> 7   251 11.905958 2.449144 1.966676 1.824506       600
#> 8   283 16.298453 2.866677 2.217334 2.029982       700
#> 9   300 20.138604 3.263878 2.450606 2.219079       800
#> 10  322 25.528281 3.780318 2.743955 2.454086       900
#> 11  342 31.906515 4.421375 3.100292 2.736337      1000

Setting parameters

Initializing a roleModel

Running a roleModel

RoLE Experiments

Calculating summary statistics

Analyzing output (machine learning?)