Quick links: Author +++ R-Forge Project page +++ CRAN


Overview

simecol (simulation of ecological systems) is a lightweight R package that employs an object oriented paradigm for the implementation of dynamic simulation models.

The package is intended to give users (students and scientists) an interactive environment to implement, distribute, simulate and document basic and advanced ecological models without the need to write long simulation programs. An object oriented approach is used to provide a consistent but still flexible and extensible way to implement simulation models of different types:

  • ordinary differential equation (ODE) models,
  • non-spatial individual-based models,
  • grid-oriented individual-based models,
  • particle diffusion-type / random walk models
  • and more.

A simulation model is implemented as simecol object (simObj) with components main, holding the main model equations, rules or arbitrary program code, equations (optional, a list of possibly nested sub-models or sub-equations ), parms with model parameters, init with the initial state, inputs (optional) for external input data and times to define the simulation time and the time steps used.

simecolModels is a simulation model collection, together with additional classes, demos and experimental code.

Download

Prerequisites

  • simecol is based on R, a freely available system for statistical computation and graphics. Current versions are tested with R version 3.0 or above.
  • simecol depends on the deSolve package for numerical integration.
  • optional: the tcltk package is required for the graphical parameter editing functions
  • Operating systems: All operating systems on which R can be installed: Linux and other Unixes, Windows, Mac

Installation

The packages can be installed directly from the internet within R or Rstudio via the menu or the R command line:

Stable Version:

install.packages("simecol")

Development versions:

install.packages("simecol", repos="http://R-Forge.R-project.org")
install.packages("simecolModels", repos="http://R-Forge.R-project.org")

Subversion (svn) access:

Anonymous SVN access (read only):

svn checkout svn://svn.r-forge.r-project.org/svnroot/simecol

Examples

Lotka-Volterra

library("simecol")
data(lv, package="simecol")
plot(sim(lv))

Conway’s Game of Life

library("simecol")
data(conway, package="simecol")
plot(sim(conway))
m <- matrix(0, 40, 40)
m[5:35,19:21] <-1
init(conway) <- m
sim(conway, animate=TRUE, delay=100, col=c("white", "green"), axes=FALSE)

Template

The following example shows that the structure of a model object is just a template.

library("simecol")
conway <- new("gridModel",
    main = function(time, init, parms) {
        x   <- init
        srv <- parms$srv
        gen <- parms$gen
        n   <- nrow(x)
        m   <- ncol(x)
        nb  <- eightneighbours(x)
        ## survival rule
        xsrv <- ifelse(x > 0 & (nb %in% srv), 1, 0)
        ## generation rule
        xgen <- ifelse(x == 0 & (nb %in% gen), 1, 0)
        x    <- as.numeric((xgen + xsrv)>0)
        dim(x) <- c(n,m)
    x
    },
    parms = list(srv=c(2, 3), gen=3),
    times = c(from=1, to=10, by=1),
    init = matrix(round(runif(40*40)), nrow=40, ncol=40),
    solver = "iteration"
)

plot(sim(conway))

Documentation

Publications

  • Petzoldt, T. and K. Rinke (2007). simecol: An Object-Oriented Framework for Ecological Modeling in R. Journal of Statistical Software, 22(9), 1–31. pdf
  • Petzoldt, T. (2003). R as a Simulation Platform in Ecological Modelling. R-News 3(3), 8–16. pdf
  • Petzoldt, T., Rinke, K. and Kates, L. (2006) Population ecology modelling with R. A Comparison of Object Oriented Approaches. The R User Conference 2006, Vienna, 2006-06-15 to 2006-06-17 slides
  • Petzoldt, T. (2008) Objects, Clones and Collections. Dynamic (Ecological) Models and Scenarios with simecol. The R User Conference 2008, Dortmund, 2008-08-12 – 2008-08-14. slides

License

simecol, like R, is free open source software licensed under the GNU Public License (GPL 2.0 or above). The software is provided as is and comes WITHOUT WARRANTY.

Author

Thomas Petzoldt, Technische Universität Dresden, Institute of Hydrobiology

Support

Please send your questions to the R-SiG-Dynamic-Models mailing list.