species-response {coenocliner} | R Documentation |
Species response models for coenocline simulation
Description
Parameterise species response curves along one or two gradients according to a Gaussian or generalised beta response model.
Usage
Gaussian(x, y = NULL, px, py = NULL, corr = 0)
Beta(x, y = NULL, px, py = NULL)
Arguments
x |
numeric; locations of observations on the primary gradient. |
y |
numeric; locations of observations on the secondary gradient. Can be missing is only a single gradient is required. |
px |
a list of named elements, each of which is a vector of numeric parameter values for the species response on the primary gradient |
py |
a list of named elements, each of which is a vector of numeric parameter values for the species response on the secondary gradient |
corr |
numeric; the correlation between gradients |
Details
Gaussian()
and Beta()
return values from appropriately parameterised Gaussian or generalised beta response models respectively. Parameters for the primary (x
) and secondary (y
) gradients are supplied as lists via arguments px
and py
. Parameters are supplied in the form of vectors, one per parameter. These vectors must be supplied to named components in the respective lists. The names of the components must match the parameters of the required response model.
For Gaussian()
the following named components must be supplied:
- opt
the species optima
- tol
the species tolerances
- h
the heights of the response curves at the optima. This parameter should only be supplied to
px
; in the case of simulations along two gradients, the height of the response curve applies to both gradients and is the hieght of a bivariate Guassian distribution at the bivariate optima.
For Beta()
the following named components must be supplied:
- A0
The heights of the species response curves at their modes. Like the parameter
h
for the Gaussian response, this parameter should only be passed viapx
; in the case of simulations along two gradients, the height of the response curve applies to both gradients and is the height of a bivariate generalised beta distribution at the bivariate mode.- m
the locations on the gradient of the modal abundance (the species optima)
- r
the ranges of occurrence of species on the gradient
- alpha
a shape parameter. With
gamma
,alpha
informs the shape of the response curve and control the skewness and kurtosis of the curve. Only positive values are allowed, which lead to unimodal response curves. Ifalpha
is equal togamma
, the species response curve is symmetric, otherwise an asymmetric curve is generated.- gamma
a shape parameter. With
alpha
,gamma
informs the shape of the response curve and control the skewness and kurtosis of the curve. Only positive values are allowed, which lead to unimodal response curves. Ifgamma
is equal toalpha
, the species response curve is symmetric, otherwise an asymmetric curve is generated.
See the examples here and in coenocline
for details on how to set up calls to these species response functions.
Value
A numeric vector of species "abundances" of length equal to length(x)
.
Author(s)
Gavin L. Simpson
Examples
# A simple example with a single species
x <- seq(from = 4, to = 6, length = 100)
px <- list(opt = 4.5, tol = 0.25, h = 20)
G <- Gaussian(x, px = px)
head(G)
length(G)
# A more complex example with 6 species, which needs the parameters
# repeating for each gradient location:
# Recreate Fig. 2 of Minchin (1987)
# Parameters for each of 6 six species
A0 <- c(5,4,7,5,9,8) * 10
m <- c(25,85,10,60,45,60)
r <- c(3,3,4,4,6,5) * 10
alpha <- c(0.1,1,2,4,1.5,1)
gamma <- c(0.1,1,2,4,0.5,4)
# Gradient locations
x <- 1:100
# expand parameter set
pars <- expand(x, m = m, A0 = A0, r = r, alpha = alpha,
gamma = gamma)
head(pars)
xvec <- pars[, "x"]
px <- as.list(data.frame(pars[, -1]))
spprc <- Beta(xvec, px = px)
matplot(matrix(spprc, ncol = 6), ## 6 species
type = "l", lty = "solid")
# Bivariate beta, single species
xx <- 1:100
yy <- 1:100
xy <- expand.grid(x = xx, y = yy)
parx <- expand(xy[, "x"], A0 = 50, m = 60, r = 40, alpha = 4, gamma = 4)
pary <- expand(xy[, "y"], m = 60, r = 40, alpha = 4, gamma = 4)
x <- parx[,1]
px <- as.list(as.list(data.frame(parx[, -1])))
y <- pary[,1]
py <- as.list(as.list(data.frame(pary[, -1])))
spprc <- Beta(x, y, px = px, py = py)
persp(xx, yy, matrix(spprc, ncol = length(xx)))