Learn R Programming

rangemodelR (version 1.0.4)

rangemod1d: Range Cohesion Model for Ordered (and Non-spatial) Data

Description

rangemod1d 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 occurence 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 rangesizes to use for simulation, can be an integer vector of same length as number of species(collumns) or either 'observed' or'unif'. See details for explanations

reps

number of replicates

Value

If degen is FALSE, a data frame with four colums 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

Details

rangemod1d impliments 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 neighbours for each site can also be used.It is important that each site must have at least one neighbour. 'rsize' provides a vector of rangesizes.It can be 'unif' - ranges are drawn from a uniform distribution,between 1 to number of sites or 'observed' - rangesize 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.

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

Run this code
# NOT RUN {
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])
# }

Run the code above in your browser using DataLab