Last data update: 2014.03.03

R: Simulation of species abundance distributions (SAD).
sim.sadR Documentation

Simulation of species abundance distributions (SAD).

Description

Creates artificial communities following given SADs.

Usage

sim.sad(n, s, sad = "lognormal", sd = 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.

Details

Species Abundance Distributions may take a number of forms. A lognormal SAD probably is the most supported by empirical data, but we include other common types useful for testing multiple algorithms including several of the functions in BAT.

Value

A matrix of species x abundance per species.

Examples

comm1 <- sim.sad(10000, 100)
comm2 <- sim.sad(10000, 100, sd = 2)
comm3 <- sim.sad(10000, 100, sad = "uniform")
par(mfrow=c(1,3))
hist(log(comm1$Freq))
hist(log(comm2$Freq))
hist(log(comm3$Freq))

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.sad.Rd_%03d_medium.png", width=480, height=480)
> ### Name: sim.sad
> ### Title: Simulation of species abundance distributions (SAD).
> ### Aliases: sim.sad
> 
> ### ** Examples
> 
> comm1 <- sim.sad(10000, 100)
> comm2 <- sim.sad(10000, 100, sd = 2)
> comm3 <- sim.sad(10000, 100, sad = "uniform")
> par(mfrow=c(1,3))
> hist(log(comm1$Freq))
> hist(log(comm2$Freq))
> hist(log(comm3$Freq))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>