Often we want to run a simulation with a variety of parameter values as inputs. This is sometimes called a simulation experiment. The
experiment function gives us an easy interface to this.
We will use the
establishment module that we created in exercise 4a.
library(ggplot2) library(SpaDES) module.path <- file.path(dirname(tempdir()), "modules") downloadModule("establishment", path = module.path) setPaths(modulePath = module.path) modules <- list("establishment") mySim <- simInit(modules = modules) # make sure the plotting device is clear clearPlot() spades(mySim)
experimentto run a
spadescall for each parameter set (note that
experimentis just a wrapper around
sum(mySim$establish), i.e., the number of pixels that had an establishment event.