Last chance! 50% off unlimited learning
Sale ends in
Simulate species probability of occurrence data according to the method used by Tahira Jamil and Cajo ter Braak in their recent paper Generalized linear mixed models can detect unimodal species-environment relationships.
simJamil(
n,
m,
x,
gl = 4,
randx = TRUE,
tol = 0.5,
tau = gl/2,
randm = TRUE,
expectation = FALSE
)
numeric; the number of samples/sites.
numeric, the number of species/variables.
numeric; values for the environmental gradient. Can be missing, in which case suitable values are generated. See Details.
numeric; gradient length in arbitrary units. The default is 4 units with gradient values ranging from -2 to 2.
logical; should locations along the gradient (x
)
be located randomly or equally-spaced?
numeric; the species tolerances. Can be a vector of
length m
, hence allowing for varying tolerances along the
gradient x
.
numeric; constant that ensures some of the optima are located beyond the observed gradient end points.
logical; should species optima along the gradient be located randomly or equally-spaced?
logical; if TRUE
the binomial probabilities
FALSE
, the default, random draws from a Bernoulli distribution
with probability
a matrix of n
rows and m
columns containing the
simulated species abundance data.
Jamil and ter Braak (2013) Generalized linear mixed models can detect unimodal species-environment relationships. PeerJ 1:e95; DOI 10.7717/peerj.95.
# NOT RUN {
set.seed(42)
N <- 100 # Number of locations on gradient (samples)
glen <- 4 # Gradient length
grad <- sort(runif(N, -glen/2, glen/2)) # sample locations
M <- 10 # Number of species
sim <- simJamil(n = N, m = M, x = grad, gl = glen, randx = FALSE,
randm = FALSE, expectation = TRUE)
## visualise the response curves
matplot(grad, sim, type = "l", lty = "solid")
## simulate binomial responses from those response curves
sim <- simJamil(n = N, m = M, x = grad, gl = glen, randx = FALSE,
randm = FALSE)
# }
Run the code above in your browser using DataLab