Resource niche metrics for a single niche
Source:R/nichecentroid.R
, R/nichepref.R
, R/nichevar.R
nichevar.Rd
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
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. ifD==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) ormode = "multiple"
(rows in P represent different niches)- Np
Vector with the number of observations per species from which the values in
P
come (inmode = "multiple"
)- Nq
The number of observations per species from which the values in
q
come (inmode = "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.
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.26315789 0.23478261 NA NA NA
#> sp2B NA 0.05935976 0.2692626 NA 0.08727273
#> sp3B NA NA NA NA NA
#> sp4B 0.39036145 0.11538462 NA NA NA
#> sp5B 0.17962657 0.05026529 0.1893713 NA NA
#> sp6B NA NA 0.1333333 NA 0.37142857
#> sp7B 0.24111675 0.14677728 0.0000000 NA NA
#> sp8B 0.78746594 NA 0.0000000 NA NA
#> sp9B 0.06223951 0.18423403 0.1535552 NA NA
#> sp10B NA 0.00000000 0.2029598 0.06007067 0.14382096
#>
#> $UF
#> R1 R2 R3 R4 R5
#> sp1B 0.7600000 0.7314578 NA NA NA
#> sp2B NA 0.5053004 0.7621472 NA 0.5188867
#> sp3B NA NA NA NA NA
#> sp4B 0.8706697 0.6000000 NA NA NA
#> sp5B 0.6646789 0.4368000 0.6723797 NA NA
#> sp6B NA NA 0.6216216 NA 0.8602151
#> sp7B 0.7368421 0.6501182 0.3628137 NA NA
#> sp8B 1.0000000 NA 0.1994460 NA NA
#> sp9B 0.5002014 0.6705882 0.6125654 NA NA
#> sp10B NA 0.2500000 0.6177076 0.4124504 0.5668310
#>
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.08820674 0.15027767
#> sp3B 0.00000000 0.00000000 0.00000000
#> sp4B 0.12034987 0.05945174 0.13219917
#> sp5B 0.18250903 0.18196789 0.18302071
#> sp6B 0.08535149 0.04281619 0.09377338
#> sp7B 0.16362581 0.13393503 0.18227634
#> sp8B 0.03317008 0.00000000 0.12346884
#> sp9B 0.16380429 0.12367828 0.18263248
#> sp10B 0.20396760 0.14247245 0.24324274
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.23567406 0.13063354 -0.086729283 0.007437578
#> sp2B 0.07944434 -0.28424049 -0.080479627 -0.163528546
#> sp3B NA NA NA NA
#> sp4B 0.23182478 0.19505638 -0.136007263 -0.017892672
#> sp5B 0.16842737 -0.05722158 -0.078835394 -0.182374955
#> sp6B 0.01312770 -0.36842390 -0.236872956 -0.130254854
#> sp7B 0.20189630 0.06504098 -0.092483731 -0.075493626
#> sp8B 0.20585744 0.31771393 -0.203930964 -0.102902852
#> sp9B 0.17791896 -0.09211635 -0.003833588 -0.136842399
#> sp10B -0.21931286 -0.27234870 -0.112158896 -0.139731432
#>
#> $UC
#> V1 V2 V3 V4
#> sp1B 0.25507317 0.3660202 0.16161541 0.135093648
#> sp2B 0.17980607 -0.1346801 0.15202432 0.059006905
#> sp3B NA NA NA NA
#> sp4B 0.25020273 0.4167995 0.09926469 0.103043647
#> sp5B 0.22279236 0.2644265 0.11604321 0.004695349
#> sp6B 0.08071558 -0.3012234 -0.03734620 0.073864241
#> sp7B 0.24333921 0.3382519 0.13868933 0.088229957
#> sp8B 0.22651902 0.4816242 -0.13513696 -0.052807342
#> sp9B 0.23485695 0.1973902 0.19214870 0.066114571
#> sp10B 0.06028116 -0.1028639 0.06855471 0.029230160
#>
# 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.30107527 0.17948718 NA NA NA
#> sp2B NA 0.06651761 0.23398329 NA 0.09961686
#> sp3B NA NA NA NA NA
#> sp4B 0.44186047 0.10679612 NA NA NA
#> sp5B 0.19266055 0.03988036 0.16871705 NA NA
#> sp6B NA NA 0.09722222 NA 0.47039474
#> sp7B 0.29458918 0.10677618 0.02660407 NA NA
#> sp8B 0.80672269 NA 0.00000000 NA NA
#> sp9B 0.09246813 0.13991255 0.15200626 NA NA
#> sp10B NA 0.00000000 0.14822030 0.05847953 0.18938271
#>
#> $UF
#> R1 R2 R3 R4 R5
#> sp1B 0.8181818 0.6976744 NA NA NA
#> sp2B NA 0.4492188 0.7471264 NA 0.6059701
#> sp3B NA NA NA NA NA
#> sp4B 0.8901099 0.5500000 NA NA NA
#> sp5B 0.7233333 0.3902439 0.6533842 NA NA
#> sp6B NA NA 0.5279330 NA 0.9009009
#> sp7B 0.8019802 0.5531429 0.3739631 NA NA
#> sp8B 1.0000000 NA 0.1910112 NA NA
#> sp9B 0.5600000 0.6048000 0.6258597 NA NA
#> sp10B NA 0.2004313 0.5730414 0.4070305 0.6629731
#>
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.10282652 0.13225261
#> sp2B 0.1320325 0.10080141 0.15035294
#> sp3B 0.0000000 0.00000000 0.00000000
#> sp4B 0.1084030 0.05347054 0.13217393
#> sp5B 0.1827155 0.18245891 0.18302462
#> sp6B 0.0736939 0.03045210 0.09372434
#> sp7B 0.1579114 0.11895654 0.18218608
#> sp8B 0.0276394 0.00000000 0.09886944
#> sp9B 0.1718765 0.13945046 0.18293736
#> sp10B 0.1962885 0.13706707 0.24370661
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.233493262 0.15429583 -0.11464761 -0.006913216
#> sp2B 0.063884557 -0.30364050 -0.10391613 -0.163585789
#> sp3B NA NA NA NA
#> sp4B 0.230355110 0.23114873 -0.15482181 -0.027563872
#> sp5B 0.170946514 -0.03149162 -0.09105508 -0.180175498
#> sp6B 0.007840834 -0.37368046 -0.25279379 -0.087163432
#> sp7B 0.202125646 0.09324967 -0.10774476 -0.074657144
#> sp8B 0.209427985 0.34603940 -0.20393096 -0.095706032
#> sp9B 0.179874585 -0.07634251 -0.03231720 -0.135968816
#> sp10B -0.216425029 -0.29266067 -0.15045223 -0.129256804
#>
#> $UC
#> V1 V2 V3 V4
#> sp1B 0.25375528 0.3973521 0.14474404 0.12642129
#> sp2B 0.16313010 -0.1628217 0.12448567 0.05382480
#> sp3B NA NA NA NA
#> sp4B 0.24737344 0.4356888 0.06304458 0.08442550
#> sp5B 0.22140713 0.2985255 0.10369654 -0.01889987
#> sp6B 0.06790171 -0.3139639 -0.07625987 0.08978439
#> sp7B 0.24087340 0.3652588 0.11763714 0.07486498
#> sp8B 0.22651902 0.4816242 -0.14422215 -0.05280734
#> sp9B 0.23418137 0.2306461 0.18519346 0.06141548
#> sp10B 0.04814612 -0.1149950 0.04350482 0.04919413
#>