rangemod1d | R Documentation |
The function takes observed site by species matrix and returns expected species richness values of each site
rangemod1d(
spmat,
var = NULL,
cohesion = T,
first = FALSE,
degen = FALSE,
rsize = c("observed", "unif"),
reps
)
spmat |
a site by species matrix or data frame with species in columns |
var |
an optional vector containing explanatory variable for constraining the randomization. It should be NULL when absent |
cohesion |
If true, species distributions are without gaps i.e. result is range cohesion, otherwise it is range scatter |
first |
If TRUE, 'var' is used while choosing the first occurrence as well.if 'var' is null, first is always set 'FALSE' |
degen |
If true, each randomized site by species matrix is saved and provided in output |
rsize |
which range sizes to use for simulation, can be an integer vector of same length as number of species(columns) or either 'observed' or 'unif'. See details for explanations |
reps |
number of replicates |
Implements simulations used by Rahbeck et.al (2007) to data which are only in form of a site by species matrix and without any spatial information. A list similar to an nb object of spdep can prepared according to order in which the rows (sites) are arranged. A manually prepared list of neighbors for each site can also be used.It is important that each site must have at least one neighbor. 'rsize' provides a vector of range sizes.It can be 'unif' - ranges are drawn from a uniform distribution,between 1 to number of sites or 'observed' - range size of each species is exactly the same as in the observed matrix. Alternatively a it can also be a user specified integer vector, of same length as number of species.
If degen is FALSE, a data frame with four columns for mean, SD and confidence intervals of expected richness
mean richness of each site
standard deviation of species richness
lower limit of the confidence interval
upper limit of the confidence interval
If degen is TRUE, then a list containing above data frame and a list of all the randomized matrices
Rahbek, C., Gotelli, N., Colwell, R., Entsminger, G., Rangel, T. & Graves, G. (2007) Predicting continental-scale patterns of bird species richness with spatially explicit models. Proceedings of the Royal Society B: Biological Sciences, 274, 165.
Gotelli, N.J., Anderson, M.J., Arita, H.T., Chao, A., Colwell, R.K., Connolly, S.R., Currie, D.J., Dunn, R.R., Graves, G.R. & Green, J.L. (2009) Patterns and causes of species richness: a general simulation model for macroecology. Ecology Letters, 12, 873-886.
tempmat <- matrix(0,nrow=10,ncol=200,dimnames=list(letters[1:10],1:200))
tempmat <- as.matrix(apply(tempmat,2,function(x){rbinom(nrow(tempmat),1,
runif(1,0.1,1))}))
rownames(tempmat) <- letters[1:10]
temp <- rangemod1d(tempmat,cohesion = TRUE,var = NULL,rsize = "observed",reps = 5)
plot(temp[,1],ylim= c(min(temp[,1] -2),max(temp[,1]+2)),pch = 16,ylab = 'Species Richness')
segments(1:10,y0=temp[,1]-temp[,2],y1= temp[,1]+temp[,2])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.