Last data update: 2014.03.03

R: Simulation of species spatial distributions.
sim.spatialR Documentation

Simulation of species spatial distributions.

Description

Creates artificial communities with given SAD and spatial clustering.

Usage

sim.spatial(n, s, sad = "lognormal", sd = 1, dist = "aggregated",
  clust = 1)

Arguments

n

total number of individuals.

s

number of species.

sad

The SAD distribution type (lognormal, uniform, broken stick or geometric). Default is lognormal.

sd

The standard deviation of lognormal distributions. Default is 1.

dist

The spatial distribution of individual species populations (aggregated, random, uniform or gradient). Default is aggregated.

clust

The clustering parameter (higher values create more clustered populations). Default is 1.

Details

The spatial distribution of individuals of given species may take a number of forms. Competitive exclusion may cause overdispersion, specific habitat needs or cooperation may cause aggregation and environmental gradients may cause abundance gradients.

Value

A matrix of individuals x (species, x coords and y coords).

Examples

par(mfrow = c(3 ,3))
comm = sim.spatial(100, 9, dist = "uniform")
for(i in 1:9){
	sp <- comm[comm[1] == paste("Sp", i, sep = ""), ]
	plot(sp$x, sp$y, main = paste("Sp", i), xlim = c(0,1), ylim = c(0,1))
}
comm = sim.spatial(1000, 9, sad = "lognormal", sd = 0.5, dist = "aggregated", clust = 2)
for(i in 1:9){
	sp <- comm[comm[1] == paste("Sp", i, sep=""), ]
	plot(sp$x, sp$y, main = paste("Sp", i), xlim = c(0,1), ylim = c(0,1))
}

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BAT)
Loading required package: nls2
Loading required package: proto
Loading required package: raster
Loading required package: sp
Loading required package: spatstat
Loading required package: nlme

Attaching package: 'nlme'

The following object is masked from 'package:raster':

    getData

Loading required package: rpart

spatstat 1.45-2       (nickname: 'Caretaker Mode') 
For an introduction to spatstat, type 'beginner' 


Attaching package: 'spatstat'

The following objects are masked from 'package:raster':

    area, rotate, shift

Loading required package: vegan
Loading required package: permute
Loading required package: lattice

Attaching package: 'lattice'

The following object is masked from 'package:spatstat':

    panel.histogram

This is vegan 2.4-0

Attaching package: 'BAT'

The following object is masked from 'package:base':

    beta

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BAT/sim.spatial.Rd_%03d_medium.png", width=480, height=480)
> ### Name: sim.spatial
> ### Title: Simulation of species spatial distributions.
> ### Aliases: sim.spatial
> 
> ### ** Examples
> 
> par(mfrow = c(3 ,3))
> comm = sim.spatial(100, 9, dist = "uniform")
> for(i in 1:9){
+ 	sp <- comm[comm[1] == paste("Sp", i, sep = ""), ]
+ 	plot(sp$x, sp$y, main = paste("Sp", i), xlim = c(0,1), ylim = c(0,1))
+ }
> comm = sim.spatial(1000, 9, sad = "lognormal", sd = 0.5, dist = "aggregated", clust = 2)
> for(i in 1:9){
+ 	sp <- comm[comm[1] == paste("Sp", i, sep=""), ]
+ 	plot(sp$x, sp$y, main = paste("Sp", i), xlim = c(0,1), ylim = c(0,1))
+ }
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>