Type: | Package |
Depends: | R (≥ 3.5) |
Title: | Mid-Domain Effect and Species Richness |
Version: | 1.0.6 |
Maintainer: | Aniruddha Marathe <aniruddha.pravin.marathe@gmail.com> |
Description: | Used for generating randomized community matrices under strict range cohesion. The package can handle data where species occurrence are recorded across sites ordered along gradients such as elevation and latitude, as well as species occurrences recorded on spatial grids with known geographic coordinates. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Imports: | sf, spdep |
Packaged: | 2025-02-21 18:08:24 UTC; shivaniagarwal |
Author: | Aniruddha Marathe [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2025-02-25 17:50:02 UTC |
Mid-Domain Effect and Species Richness Patterns
Description
Range Cohesion and Range Scatter Models in R
Details
Package: | rangemodelR |
Type: | Package |
Version: | 1.0.6 |
Date: | 2023-06-08 |
License: | GPL (>= 2) |
LazyLoad: | No |
Used for generating randomized community matrices under
strict range cohesion. The package can handle data where species occurrence
are recorded across one or two dimensions.One dimensional data are typically
for sites ordered along a variable of interest such
as elevation or latitude.rangemod1d
is used for such data.
Range cohesion is enforced using an 'nb' object
(generated by poly2nb
of the spdep package).
Author(s)
Aniruddha Marathe aniruddha.pravin.marathe@gmail.com
References
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.
Colwell, Robert K., and David C. Lees. "The mid-domain effect: geometric constraints on the geography of species richness." Trends in ecology & evolution 15.2 (2000): 70-76.
random.range - supporting function for other rangemodel fucntions
Description
It is used within other functions in this package to radomly place given number of species occurrences
Usage
random.range(uid, nb, range.size, var, first)
Arguments
uid |
a vector of unique ids for selection |
nb |
a neighbour object similar to generated from 'shp2nb' |
range.size |
a vector of number of sites occupied by each species |
var |
an optional vector of variables for constraining the randomization |
first |
If true, var is used while choosing the first occurrence as well. if var is null, first is always set FALSE |
Details
this function is not intended for any direct use but is called within other functions of this package.
Value
a numeric vector specifying selected positions in 'uid'
Range Cohesion Model for Ordered (and Non-spatial) Data
Description
The function takes observed site by species matrix and returns expected species richness values of each site
Usage
rangemod1d(
spmat,
var = NULL,
cohesion = T,
first = FALSE,
degen = FALSE,
rsize = c("observed", "unif"),
reps
)
Arguments
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 |
Details
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.
Value
If degen is FALSE, a data frame with four columns for mean, SD and confidence intervals of expected richness
- "mod.rich"
mean richness of each site
- "mod.sd"
standard deviation of species richness
- "q2.5"
lower limit of the confidence interval
- "q97.5"
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
References
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.
Examples
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])