nichevar: Resource niche metrics for a single niche

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Function nichepref computes the species resource preference from a the species resource use (and resource availability when given). Function nichecentroid computes the centroid on the resource space for a set of species. Function nichevar computes the multivariate resource variance for a set of species (i.e. niche breadth). In all functions resources are given in distance matrix D, the species resource use is given in P and the availability of resources, if present, are given by vector q.

Usage

1
2
3
4
5
6
nichevar(P, D = NULL, q = NULL, mode="multiple", Np = NULL, 
Nq = NULL, nboot = 1000, alpha=0.05)
nichecentroid(P, D = NULL, q = NULL, mode="multiple", Np = NULL, 
Nq = NULL, nboot = 1000, alpha=0.05)
nichepref(P, D = NULL, q = NULL, mode="multiple", Np = NULL, 
Nq = NULL, nboot = 1000, alpha=0.05)

Arguments

P

Data frame containing the relative or absolute usage that a set of species (in rows) make of a set of resources (in columns).

D

Object of type dist containing distance values between resources. If no distance matrix is provided (i.e. if D==NULL), the distances between resources is assumed to be maximum.

q

Vector with the availability of each resource.

mode

Either mode = "single" (rows of matrix P are individual observations to be pooled for a single niche) or mode = "multiple" (rows in P represent different niches).

Np

Vector with the number of observations per species from which the values in P come (in mode = "multiple").

Nq

The number of observations per species from which the values in q come (in mode = "multiple").

nboot

Number of boostrap samples used to compute bias-corrected percentile confidence intervals.

alpha

Used to set the confidence level (i.e. alpha = 0.05 means 95 percent confidence interval).

Details

The method is described in De Caceres et al. (2010). If the distance matrix is not specified (i.e. if D=NULL) the function assumes that all resources are at a maximum distance (d=1). If the resource availability vector q is given then the values in P are taken as assessments of resource use and the species preference is calculated taking into account resource availability. Otherwise resource use is equated to resource preference. Moreover, most functions can compute bootstrap confidence intervals following the bias-corrected percentile method (Manly 2007). If mode = "multiple" and Np != NULL, bootstrap samples for a given species are generated assuming a multinomial distribution with the proportions calculated from the corresponding row values in P, and the number of observations comes from the corresponding element in Np. If mode = "single" then the bootstrapped units are the rows of matrix P. In both cases, if Nq is indicated the availability of resources is also bootstrapped. The bias-corrected percentile method was described for overlap niche measures in Mueller and Altenberg (1985) and is extended here for all niche metrics.

Value

Function nichepref returns a matrix of species relative preference. Function nichevar returns a vector with the variance of the resources used for each species in P. Function nichecentroid returns a matrix niche centroid in the resource space for each species in df. If bootstrap confidence intervals are asked then the three functions also compute two extra data containing respectively the lower and upper bounds of the confidence intervals obtained following the bias-corrected percentile method. Function nichearea returns the area of the convex hull occupied by the resources used for each species in P.

Author(s)

Miquel De Caceres Ainsa, CTFC

References

Mueller, L.D. and L. Altenberg. 1985. Statistical Inference on Measures of Niche Overlap. Ecology 66:1204-1210.

Manly, B.F.J. 2007. Randomization, bootstrap and Monte Carlo methods in biology. Chapman and Hall texts in statistical science series. 2nd edition.

De Caceres, M., Sol, D., Lapiedra, O. and P. Legendre. (2011) A framework for estimating niche metrics using the resemblance between qualitative resources. Oikos 120: 1341-1350.

See Also

See nicheoverlap for descriptors comparing two niches.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Loads example data
data(birds)

# The niche metrics using distances among resources and assuming equal availability of resources
nichepref(birdsbreed, D = resourceD) 
nichevar(birdsbreed, D = resourceD) 
nichecentroid(birdsbreed, D = resourceD) 

# The niche metrics using distances among resources and computes 
# 95 percent confidence intervals
nichepref(birdsbreed, D = resourceD, mode="multiple", 
Np = rowSums(birdsbreed), Nq = 100) 
nichevar(birdsbreed, D = resourceD, mode="multiple", 
Np = rowSums(birdsbreed), Nq = 100) 
nichecentroid(birdsbreed, D = resourceD, mode="multiple", 
Np = rowSums(birdsbreed), Nq = 100) 

# Same computations with different resource availability
nichepref(birdsbreed, D = resourceD, 
q = c(0.18, 0.24, 0.22, 0.21, 0.15), mode="multiple")
nichevar(birdsbreed, D = resourceD, 
q = c(0.18, 0.24, 0.22, 0.21, 0.15), mode="multiple")
nichecentroid(birdsbreed, D = resourceD, 
q = c(0.18, 0.24, 0.22, 0.21, 0.15), mode="multiple")

# The niche metrics using distances among resources and 
# computes 95 percent confidence intervals
nichepref(birdsbreed, D = resourceD, 
q = c(0.18, 0.24, 0.22, 0.21, 0.15), mode="multiple", Np = rowSums(birdsbreed), Nq = 100)
nichevar(birdsbreed, D = resourceD, 
q = c(0.18, 0.24, 0.22, 0.21, 0.15), mode="multiple", Np = rowSums(birdsbreed), Nq = 100)
nichecentroid(birdsbreed, D = resourceD, 
q = c(0.18, 0.24, 0.22, 0.21, 0.15), mode="multiple",  Np = rowSums(birdsbreed), Nq = 100)

# The following example defines a function to calculate the area of the niche
# It requires package 'rgeos'
library(rgeos)
nichearea <- function (P, D = NULL, axes=c(1,2)) {
    if (is.null(D)) 
       D <- as.dist((matrix(1, ncol(P), ncol(P)) - diag(rep(1, ncol(P)))))
    cmd = cmdscale(D,eig=TRUE,k= ncol(P)-1)
    X = cmd$points
    V <- data.frame(Area=rep(0, nrow(P)))
    for (i in 1:nrow(P)) {
    	  pi = as.numeric(P[i,])
        if (is.na(sum(pi))) V[i, ] <- NA
        else if (sum(pi) < 1e-16) V[i, ] <- 0
        else if (sum(pi>0)==1) V[i,]<-0
   	   	else {
   	   		a =X[pi>0,axes]
	   	   	V[i,]=area.poly(as(a[chull(a),],"gpc.poly"))
   	   	}        	
    }
    return(V)
}
nichearea(birdsbreed, D = resourceD)

vegmod/indicspecies documentation built on Nov. 20, 2020, 7:04 a.m.