Learn R Programming

phyloclim (version 0.9.5)

hypothesis.testing: Niche Equivalency and Background Similarity Test

Description

Hypothesis testing as proposed by Warren et al. (2008) based on the generation of pseudoreplicate datasets. The niche equivalency (or identity) test asks whether the ecological niche models (ENMs) of two species are more different than expected if they were drawn from the same underlying distribution. The background similarity test asks whether ENMs drawn from populations with partially or entirely non-overlapping distributions are any more different from one another than expected by random chance.

Usage

niche.equivalency.test(p, env, n = 99, app, dir)

bg.similarity.test(p, env, n = 99, conf.level = .95, app, dir)

# S3 method for ntest print(x, …)

# S3 method for ntest plot(x, …)

Arguments

p

a SpatialPointsDataFrame or a simple data frame containing the presence points. In the latter case the first column contains the species names, the second and third column longitude and latitude (see SWD-formatted (=Samples-With-Data) files in the MAXENT tutorial).

env

an object of class SpatialGridDataFrame containing the environmental covariates.

n

an integer giving the number of permutations of the original data (default: n = 99).

conf.level

a real number between 0 and 1 setting the confidence level of the confidence intervals to be calculated.

app

a character string giving the path to the MAXENT application.

dir

a character string giving the name of a directory where the input and output data for MAXENT will be saved. Already existing directories will be overwritten without a warning. If dir is left empty the data will be written to a temporary directory, which will be deleted after execution.

x

an object of class ntest.

further arguments passed to or from other methods.

Value

niche.equivalency.test gives a list with six elements:

method

name of the test.

species

names of the two species compared.

null

formulation of the null hypothesis.

statistic

statistics of niche overlap D based on Schoeners D and modified Hellinger distances.

p.value

p-values associated with the statistics.

null.distribution

null distributions of D and I derived from randomization.

bg.similarity.test gives a list with eight elements:

method

name of the test.

species

names of the two species compared.

null

formulation of the null hypothesis.

statistic

statistics of niche overlap D based on Schoeners D and modified Hellinger distances.

ci.x.randomY

confidence interval for D and I based on the comparison of the first species against a randomized background derived from the second species.

ci.y.randomX

confidence interval for D and I based on the comparison of the second species against a randomized background derived from the first species.

nd.x.randomY

null distributions of D and I calculated from the comparison of the first species against a randomized background derived from the second species.

nd.y.randomX

null distributions of D and I calculated from the comparison of the second species against a randomized background derived from the first species.

Details

An installation of MAXENT (Phillips et al., 2006; http://www.cs.princeton.edu/~schapire/maxent/) is required in order to run niche.equivalency.test and bg.similarity.test. Both functions use the logistic output of MAXENT estimated using auto features.

By default, the environmental covariates given with env are assumend to be continuous. In order to use categorical environmental covariates, you have to prepend "cat_" to the layer name, e.g. "cat_landuse".

References

Phillips, S.J, M. Dudik, & R.E. Schapire. 2006. Maximum entropy modeling of species geographic distributions. Ecological Modeling 190: 231-259.

Warren, D., R.E. Glor, & M. Turelli. 2008. Environmental niche equivalency versus conservatism: quantitative approaches to niche evolution. Evolution. 62: 2868-2883.

See Also

niche.overlap

Examples

Run this code
# NOT RUN {
# path to MAXENT
# --------------
maxent.exe <- paste(system.file(package="dismo"), 
"/java/maxent.jar", sep = "")

# a data frame of coordinates where two species 
# have been detected ('presence points') and
# a raster stack of environmental covariables
# --------------------------------------
species <- c("enneaphylla", "laciniata")
data(sites)
samples <- sites[grep(paste(species, collapse = "|"), sites$spec), ]
data.path <- system.file("extdata", package = "phyloclim")
preds <- list.files(path = data.path, pattern = "[.]asc")
preds <- paste(data.path, preds, sep = "/")
preds <- stack(lapply(X = preds, FUN = raster))

# testing against 9 permutations of the data
# -------------------------------------------
reps <- 9

# run hypothesis tests
# --------------------
if (file.exists(maxent.exe)){
  net <- niche.equivalency.test(samples, preds, reps, maxent.exe)
  net; plot(net)
  bst <- bg.similarity.test(samples, preds, reps, app = maxent.exe)
  bst; plot(bst)
} else {
  message("get a copy of MAXENT (see Details)")
}
# }

Run the code above in your browser using DataLab