R-Forge Logo

Welcome to simecol - Ecological Models with R project!

simecol allows to implement ecological models (ODEs, IBMs, ...) using a template-like object-oriented stucture. It helps to organize scenarios and may also be useful for other areas.

What is simecol and what is simecolModels?

simecol (simulation of ecological systems) is an R package which is based on an object oriented paradigm for the implementation of dynamic simulation models.

The simecol 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. For this purpose, an object oriented approach is developed, which should provide a consistent but still flexible and extensible way to implement simulation models of different types, namely

Each simulation model is implemented as simecol simulation model object 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.

Downloads and Project Pages

simecol

simecolModels

Author

Prerequisites

Installation

The packages can be installed directly from the internet within R either via the menu (on Windows) or via 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

Documentation

Reference Manual

Articles

Additional Material

Examples

A basic Lotka-Volterra model

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

The classical 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)

Object oriented (S4 based) representation of a simulation model object (simecol object).



library("simecol") # load the package first!

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"
)

## and to run this example:

plot(sim(conway))

License

Links