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.

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
)

nichevar(
  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)

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.

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.

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.

Author

Miquel De Caceres Ainsa, EMF-CREAF

Examples

# Loads example data
data(birds)

# The niche metrics using distances among resources and assuming equal availability of resources
nichepref(birdsbreed, D = resourceD) 
#>         R1   R2   R3  R4   R5
#> sp1B  0.50 0.50 0.00 0.0 0.00
#> sp2B  0.00 0.25 0.50 0.0 0.25
#> sp3B  1.00 0.00 0.00 0.0 0.00
#> sp4B  0.65 0.35 0.00 0.0 0.00
#> sp5B  0.40 0.20 0.40 0.0 0.00
#> sp6B  0.00 0.00 0.35 0.0 0.65
#> sp7B  0.50 0.35 0.15 0.0 0.00
#> sp8B  0.95 0.00 0.05 0.0 0.00
#> sp9B  0.25 0.40 0.35 0.0 0.00
#> sp10B 0.00 0.08 0.40 0.2 0.32
nichevar(birdsbreed, D = resourceD) 
#>                B
#> sp1B  0.13225261
#> sp2B  0.12781527
#> sp3B  0.00000000
#> sp4B  0.12034987
#> sp5B  0.18250903
#> sp6B  0.08535149
#> sp7B  0.16362581
#> sp8B  0.03317008
#> sp9B  0.16380429
#> sp10B 0.20396760
nichecentroid(birdsbreed, D = resourceD) 
#>                V1          V2           V3           V4
#> sp1B   0.24597349  0.25041608  0.045122608  0.075213113
#> sp2B   0.13250560 -0.21553586  0.061091362 -0.058985021
#> sp3B   0.22651902  0.48162424 -0.203930964 -0.052807342
#> sp4B   0.24013715  0.31977853 -0.029593464  0.036806977
#> sp5B   0.19752919  0.09742813  0.025164313 -0.093896342
#> sp6B   0.04412588 -0.33760340 -0.146142950 -0.016090090
#> sp7B   0.22634780  0.21038621  0.018959230  0.002195533
#> sp8B   0.22192256  0.44516014 -0.187746733 -0.064344489
#> sp9B   0.20990744  0.04140897  0.108601511 -0.031151012
#> sp10B -0.05078743 -0.19448565 -0.005282383 -0.055185386

# The niche metrics using distances among resources and computes 
# 95 percent confidence intervals
nichepref(birdsbreed, D = resourceD, mode="multiple", 
          Np = rowSums(birdsbreed), Nq = 100) 
#> $F
#>         R1   R2   R3  R4   R5
#> sp1B  0.50 0.50 0.00 0.0 0.00
#> sp2B  0.00 0.25 0.50 0.0 0.25
#> sp3B  1.00 0.00 0.00 0.0 0.00
#> sp4B  0.65 0.35 0.00 0.0 0.00
#> sp5B  0.40 0.20 0.40 0.0 0.00
#> sp6B  0.00 0.00 0.35 0.0 0.65
#> sp7B  0.50 0.35 0.15 0.0 0.00
#> sp8B  0.95 0.00 0.05 0.0 0.00
#> sp9B  0.25 0.40 0.35 0.0 0.00
#> sp10B 0.00 0.08 0.40 0.2 0.32
#> 
#> $LF
#>               R1         R2         R3         R4         R5
#> sp1B  0.25116279 0.25049702         NA         NA         NA
#> sp2B          NA 0.07778951 0.25089445         NA 0.07536232
#> sp3B          NA         NA         NA         NA         NA
#> sp4B  0.38340807 0.12371134         NA         NA         NA
#> sp5B  0.17832168 0.04996713 0.18058691         NA         NA
#> sp6B          NA         NA 0.12903226         NA 0.37500000
#> sp7B  0.25304808 0.12241399 0.03240619         NA         NA
#> sp8B  0.76576577         NA 0.00000000         NA         NA
#> sp9B  0.08759124 0.17422000 0.13914657         NA         NA
#> sp10B         NA 0.00000000 0.20356120 0.07094595 0.14027046
#> 
#> $UF
#>              R1        R2        R3       R4        R5
#> sp1B  0.7428571 0.7411765        NA       NA        NA
#> sp2B         NA 0.5253072 0.7541160       NA 0.4832215
#> sp3B         NA        NA        NA       NA        NA
#> sp4B  0.8666667 0.6060606        NA       NA        NA
#> sp5B  0.6630763 0.4330868 0.6589229       NA        NA
#> sp6B         NA        NA 0.6206897       NA 0.8636364
#> sp7B  0.7531486 0.6188119 0.3974563       NA        NA
#> sp8B  1.0000000        NA 0.2212389       NA        NA
#> sp9B  0.5242553 0.6582278 0.6142542       NA        NA
#> sp10B        NA 0.2511464 0.6246598 0.441202 0.5833333
#> 
nichevar(birdsbreed, D = resourceD, mode="multiple", 
         Np = rowSums(birdsbreed), Nq = 100) 
#>                B         LC         UC
#> sp1B  0.13225261 0.13225261 0.13225261
#> sp2B  0.12781527 0.08904435 0.15071921
#> sp3B  0.00000000 0.00000000 0.00000000
#> sp4B  0.12034987 0.06526998 0.13219753
#> sp5B  0.18250903 0.18200533 0.18302117
#> sp6B  0.08535149 0.04511253 0.09377338
#> sp7B  0.16362581 0.13768302 0.18234787
#> sp8B  0.03317008 0.00000000 0.12772244
#> sp9B  0.16380429 0.12160252 0.18250903
#> sp10B 0.20396760 0.14563038 0.24359023
nichecentroid(birdsbreed, D = resourceD, mode="multiple", 
              Np = rowSums(birdsbreed), Nq = 100) 
#> $C
#>                V1          V2           V3           V4
#> sp1B   0.24597349  0.25041608  0.045122608  0.075213113
#> sp2B   0.13250560 -0.21553586  0.061091362 -0.058985021
#> sp3B   0.22651902  0.48162424 -0.203930964 -0.052807342
#> sp4B   0.24013715  0.31977853 -0.029593464  0.036806977
#> sp5B   0.19752919  0.09742813  0.025164313 -0.093896342
#> sp6B   0.04412588 -0.33760340 -0.146142950 -0.016090090
#> sp7B   0.22634780  0.21038621  0.018959230  0.002195533
#> sp8B   0.22192256  0.44516014 -0.187746733 -0.064344489
#> sp9B   0.20990744  0.04140897  0.108601511 -0.031151012
#> sp10B -0.05078743 -0.19448565 -0.005282383 -0.055185386
#> 
#> $LC
#>                V1          V2            V3          V4
#> sp1B   0.23641112  0.12880998 -0.0772935545  0.01228780
#> sp2B   0.08546521 -0.27990636 -0.0674609413 -0.16673655
#> sp3B           NA          NA            NA          NA
#> sp4B   0.23182478  0.19261404 -0.1360072626 -0.01789267
#> sp5B   0.16563096 -0.07941343 -0.0872778194 -0.19887716
#> sp6B   0.01529667 -0.36626736 -0.2308792310 -0.13177590
#> sp7B   0.20113303  0.06934313 -0.0949032201 -0.07931252
#> sp8B   0.20661685  0.32373843 -0.2039309642 -0.10110238
#> sp9B   0.17517710 -0.09063414 -0.0009803367 -0.14985108
#> sp10B -0.20926485 -0.27239513 -0.1053456998 -0.14769381
#> 
#> $UC
#>               V1          V2          V3           V4
#> sp1B  0.25595449  0.35744595  0.17289792  0.140893172
#> sp2B  0.18326851 -0.12942382  0.15597124  0.049400671
#> sp3B          NA          NA          NA           NA
#> sp4B  0.25039876  0.41665666  0.10177428  0.104333646
#> sp5B  0.22135547  0.26918685  0.11516566 -0.008580549
#> sp6B  0.08179926 -0.30014598 -0.03541147  0.066023289
#> sp7B  0.24532907  0.34709437  0.13448431  0.090954646
#> sp8B  0.22651902  0.48162424 -0.13919404 -0.052807342
#> sp9B  0.23582450  0.19426779  0.19649258  0.079991202
#> sp10B 0.05117636 -0.09266109  0.07463753  0.029626334
#> 

# Same computations with different resource availability
nichepref(birdsbreed, D = resourceD, 
          q = c(0.18, 0.24, 0.22, 0.21, 0.15), mode="multiple")
#>              R1         R2        R3        R4        R5
#> sp1B  0.5714286 0.42857143 0.0000000 0.0000000 0.0000000
#> sp2B  0.0000000 0.20912548 0.4562738 0.0000000 0.3346008
#> sp3B  1.0000000 0.00000000 0.0000000 0.0000000 0.0000000
#> sp4B  0.7123288 0.28767123 0.0000000 0.0000000 0.0000000
#> sp5B  0.4559585 0.17098446 0.3730570 0.0000000 0.0000000
#> sp6B  0.0000000 0.00000000 0.2685422 0.0000000 0.7314578
#> sp7B  0.5648267 0.29653402 0.1386393 0.0000000 0.0000000
#> sp8B  0.9587156 0.00000000 0.0412844 0.0000000 0.0000000
#> sp9B  0.2989130 0.35869565 0.3423913 0.0000000 0.0000000
#> sp10B 0.0000000 0.06364688 0.3471648 0.1818482 0.4073401
nichevar(birdsbreed, D = resourceD, 
         q = c(0.18, 0.24, 0.22, 0.21, 0.15), mode="multiple")
#>               B
#> sp1B  0.1295536
#> sp2B  0.1320325
#> sp3B  0.0000000
#> sp4B  0.1084030
#> sp5B  0.1827155
#> sp6B  0.0736939
#> sp7B  0.1579114
#> sp8B  0.0276394
#> sp9B  0.1718765
#> sp10B 0.1962885
nichecentroid(birdsbreed, D = resourceD, 
              q = c(0.18, 0.24, 0.22, 0.21, 0.15), mode="multiple")
#>                V1          V2           V3          V4
#> sp1B   0.24319428  0.28344582  0.009543526  0.05692448
#> sp2B   0.11538330 -0.23815073  0.019354147 -0.04407079
#> sp3B   0.22651902  0.48162424 -0.203930964 -0.05280734
#> sp4B   0.23771200  0.34860037 -0.060639868  0.02084826
#> sp5B   0.19887707  0.13049445  0.001990427 -0.09510860
#> sp6B   0.03278895 -0.34887535 -0.179465031  0.01742794
#> sp7B   0.22531187  0.24339492 -0.011349848 -0.00887254
#> sp8B   0.22272378  0.45151627 -0.190567838 -0.06233343
#> sp9B   0.20899979  0.06605766  0.085564703 -0.03997096
#> sp10B -0.05135008 -0.21784275 -0.043129123 -0.03244865

# 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)
#> $F
#>              R1         R2        R3        R4        R5
#> sp1B  0.5714286 0.42857143 0.0000000 0.0000000 0.0000000
#> sp2B  0.0000000 0.20912548 0.4562738 0.0000000 0.3346008
#> sp3B  1.0000000 0.00000000 0.0000000 0.0000000 0.0000000
#> sp4B  0.7123288 0.28767123 0.0000000 0.0000000 0.0000000
#> sp5B  0.4559585 0.17098446 0.3730570 0.0000000 0.0000000
#> sp6B  0.0000000 0.00000000 0.2685422 0.0000000 0.7314578
#> sp7B  0.5648267 0.29653402 0.1386393 0.0000000 0.0000000
#> sp8B  0.9587156 0.00000000 0.0412844 0.0000000 0.0000000
#> sp9B  0.2989130 0.35869565 0.3423913 0.0000000 0.0000000
#> sp10B 0.0000000 0.06364688 0.3471648 0.1818482 0.4073401
#> 
#> $LF
#>               R1         R2         R3        R4        R5
#> sp1B  0.30136986 0.21052632         NA        NA        NA
#> sp2B          NA 0.06512159 0.22329114        NA 0.1013216
#> sp3B          NA         NA         NA        NA        NA
#> sp4B  0.44247788 0.10344828         NA        NA        NA
#> sp5B  0.20225114 0.03751234 0.15572859        NA        NA
#> sp6B          NA         NA 0.09979633        NA 0.4554140
#> sp7B  0.30223390 0.10199324 0.02941176        NA        NA
#> sp8B  0.81250000         NA 0.00000000        NA        NA
#> sp9B  0.09168081 0.16251280 0.13576367        NA        NA
#> sp10B         NA 0.00000000 0.15793380 0.0508546 0.1894012
#> 
#> $UF
#>              R1        R2        R3        R4        R5
#> sp1B  0.7878788 0.6792453        NA        NA        NA
#> sp2B         NA 0.4518686 0.7041916        NA 0.6105055
#> sp3B         NA        NA        NA        NA        NA
#> sp4B  0.8947368 0.5510204        NA        NA        NA
#> sp5B  0.7154127 0.3902439 0.6254626        NA        NA
#> sp6B         NA        NA 0.5433962        NA 0.9000000
#> sp7B  0.8126060 0.5309394 0.3641045        NA        NA
#> sp8B  1.0000000        NA 0.1670379        NA        NA
#> sp9B  0.5630100 0.6185819 0.6141732        NA        NA
#> sp10B        NA 0.2069525 0.6111869 0.4021194 0.6728078
#> 
nichevar(birdsbreed, D = resourceD, 
         q = c(0.18, 0.24, 0.22, 0.21, 0.15), mode="multiple", 
         Np = rowSums(birdsbreed), Nq = 100)
#>               B         LC         UC
#> sp1B  0.1295536 0.10112443 0.13225261
#> sp2B  0.1320325 0.10665296 0.15139354
#> sp3B  0.0000000 0.00000000 0.00000000
#> sp4B  0.1084030 0.05354881 0.13220553
#> sp5B  0.1827155 0.18270758 0.18295593
#> sp6B  0.0736939 0.03187491 0.09368133
#> sp7B  0.1579114 0.12081207 0.18201463
#> sp8B  0.0276394 0.00000000 0.10388192
#> sp9B  0.1718765 0.13909405 0.18286610
#> sp10B 0.1962885 0.14317486 0.23937451
nichecentroid(birdsbreed, D = resourceD, 
              q = c(0.18, 0.24, 0.22, 0.21, 0.15), mode="multiple",  
              Np = rowSums(birdsbreed), Nq = 100)
#> $C
#>                V1          V2           V3          V4
#> sp1B   0.24319428  0.28344582  0.009543526  0.05692448
#> sp2B   0.11538330 -0.23815073  0.019354147 -0.04407079
#> sp3B   0.22651902  0.48162424 -0.203930964 -0.05280734
#> sp4B   0.23771200  0.34860037 -0.060639868  0.02084826
#> sp5B   0.19887707  0.13049445  0.001990427 -0.09510860
#> sp6B   0.03278895 -0.34887535 -0.179465031  0.01742794
#> sp7B   0.22531187  0.24339492 -0.011349848 -0.00887254
#> sp8B   0.22272378  0.45151627 -0.190567838 -0.06233343
#> sp9B   0.20899979  0.06605766  0.085564703 -0.03997096
#> sp10B -0.05135008 -0.21784275 -0.043129123 -0.03244865
#> 
#> $LC
#>                V1          V2          V3           V4
#> sp1B   0.23388017  0.15407935 -0.10878690 -0.003900651
#> sp2B   0.06486925 -0.30002726 -0.11377532 -0.164991423
#> sp3B           NA          NA          NA           NA
#> sp4B   0.23123525  0.20910689 -0.14318619 -0.021582841
#> sp5B   0.17029989 -0.05709205 -0.09375659 -0.178853197
#> sp6B   0.01032611 -0.37120943 -0.24548893 -0.101981543
#> sp7B   0.20496314  0.09194057 -0.11506022 -0.078132172
#> sp8B   0.20846750  0.33841976 -0.20393096 -0.098116868
#> sp9B   0.17669539 -0.07743375 -0.02699422 -0.139913029
#> sp10B -0.19985031 -0.30249628 -0.16726156 -0.123879453
#> 
#> $UC
#>               V1         V2          V3           V4
#> sp1B  0.25375528  0.3923301  0.14474404  0.126421295
#> sp2B  0.16819997 -0.1530703  0.13756963  0.044444627
#> sp3B          NA         NA          NA           NA
#> sp4B  0.24900768  0.4244717  0.08635664  0.096408553
#> sp5B  0.22336025  0.2989476  0.09961470 -0.007649655
#> sp6B  0.07196099 -0.3099279 -0.06432861  0.082207251
#> sp7B  0.24083490  0.3744962  0.10029485  0.062918961
#> sp8B  0.22651902  0.4816242 -0.14227675 -0.052807342
#> sp9B  0.23284313  0.2176928  0.17978349  0.058696476
#> sp10B 0.04204519 -0.1202665  0.04794171  0.055767773
#>