December 7, 2016

Examples

1. Demo modules in SpaDES package

  • The demo modules are simple, proof of concept modules.

  • There are 3 different types of modules:

    • Event (fireSpread)
    • Agent (caribouMovement)
    • Data generation (randomLandscapes)
  • How to find them:

# Locate SpaDES on your computer; they are in the sampleModule folder
whereSpaDES <- find.package(package  = "SpaDES")
whereSamples <- system.file('sampleModules', package = 'SpaDES')
file.path(whereSamples, 'caribouMovement', 'caribouMovement.R') %>%
  file.edit()

2. Simple forest dynamics model

  • More modules than SpaDES demo
  • Vegetation component is simple, but data-driven (LCC 2005)
  • Neither caribou, nor fire are data-driven
  • During simulation, it shows:

    • maps
    • data summary plots
    • text legends
    • colour matching between map and histogram
    • modular plotting (each module is unaware of other plots)

2. Simple forest dynamics model

  • Freely available from the SpaDES-Modules repository
  • This repository is intended to be like CRAN, but for SpaDES modules; makes them easy to distribute to others
  • How to find it:
## specify where to save files
moduleDir <- file.path(tempdir(), 'SpaDES_modules')

## download all necessary modules
downloadModule('LCC2005', path = moduleDir, data = TRUE)

## look at module or helper .Rmd file
openModules('LCC2005', path = moduleDir) 

3. SpaDES-Landis Biomass Succession

  • This is a rewrite in R of a core LANDIS vegetation dynamics module
  • Slightly different implementation, making it faster under many situations
  • Cross-platform (LANDIS is Windows-only)
  • Allows scientist easier access to code, e.g.,

    • making growth climate sensitive
    • changing mortality functions
    • dividing up large problems into small parallel problems
  • Not yet published

3. SpaDES-Landis Biomass Succession

Example results

  • Features:

    • Shows a random location in western boreal forest
    • Uses shiny to make it an interactive web page
    • Shows maps
    • Data summaries
    • Pre-run results
    • Can be easily published online, once public:

      (top right)

3. SpaDES-Landis Biomass Succession

Running the app

shiny::runApp("~/GitHub/LandwebApp/")

4. Wolf IBM (wolfAlps)

  • Agent based model of demography and dispersal of wolves in the Italian Alps
  • R port of the original SELES model that was used in (Marucco and McIntire 2010)
  • Can run this on your computer, in R

4. Wolf IBM (wolfAlps)

  • Features:

    • Incremental visuals
    • One module
    • Progress bar
    • Caching (automatic saving)
    • Parallel simulations
    • Summarizing across parallel runs
  • Go to model

4. Wolf IBM (wolfAlps)

downloadModule("wolfAlps", path = moduleDir, data = TRUE)
  • The .Rmd file shows how to run it:
openModules("wolfAlps", path = moduleDir)

5. A shiny app on shinyapps.io

5. A shiny app on shinyapps.io

  • Features:

    • Uses the shiny package to create dynamic web page
    • hosted on shinyapps.io because it's very easy to do so (click on "Publish" button in RStudio):

      (top right)

    • Allows user to change parameters
    • Shows some ideas about modularity (click modules on and off), only partially implemented

Ecological modelling in SpaDES

During this workshop we will learn how to:

  • break down ecological processes into discrete events;
  • organize ecological processes into SpaDES modules;
  • rapidly prototype and develop complex ecological models in SpaDES;
  • parameterize and evaluate simulation models;
  • perform scenario analyses, e.g., for decision support;
  • build portable, reproducible models;
  • share models, analyses, and code.

Where to get help

Next

Thinking the SpaDES way (slides)