betalinkr: Calculate network dissimilarity (beta diversity) and its...

View source: R/betalinkr.R

betalinkrR Documentation

Calculate network dissimilarity (beta diversity) and its components

Description

This function (betalinkr) is a new implementation of network dissimarility, as proposed by Tim Poisot (originally implemented in the betalink package). Following Poisot, dissimilarity (of a pair of networks) is partitioned into the dissimilarity due to difference in species composition (“ST”) and dissimilarity due to rewiring (“OS”, dissimilarity of shared species subweb). Different partitioning approaches and many binary and quantitative indices are available. The recommended method for additive partitioning is commondenom (originally proposed by Novotny 2009), for which further partitioning into different aspects of species composition differences (partition.st) and into replacement and richness difference components (partition.rr) are also available.

betalinkr_multi is a metafunction that calls betalinkr for all pairs of networks (passing arguments), and returns a data.frame.

Usage

betalinkr(webarray, index="bray", binary=TRUE, partitioning="commondenom",
          proportions=!binary, function.dist="vegdist", distofempty="zero",
          partition.st=FALSE, partition.rr=FALSE)

betalinkr_multi(webarray, ...)

Arguments

webarray

Input data, an array with three dimensions, third dimension has length 2 and separates the two webs to compare. First two dimensions are the species (typically first Lower and second Higher). For convenience, if webarray is a list of two webs, it will be converted to array format first using webs2array (that function can also be used to convert single web matrices to array format, but then needs to be called explicitly). NOTE: When using betalinkr_multi, webarray must be an array! Use webs2array when providing networks (see last example below).

index

The dissimilarity index, passed to "method" of either vegdist or betadiver (see there for naming). If partitioning="commondenom" (and thus no external function is used), it has to be one of sorensen (for Sorensen or Bray-Curtis dissimilarity index) or jaccard (for Jaccard or Ruzicka); bray is also allowed and gives the same result as sorensen.

binary

Should binary data or quantitative data be used (i.e., quantitative or binary versions of dissimilarity indices). If TRUE, webs will be converted to binary.

partitioning

How should the components (“ST” and “OS”) be calculated? With poisot, the original approach will be applied, which calculates ST as WN - OS; not recommended for partitioning as it underestimates the contribution of species composition. But with this setting, OS will reflect the uncorrected dissimilarity of shared species subwebs, which may be interesting as such.

With commondenom (recommended setting), an alternative partitioning approach is used that should give fair contributions for OS and ST. It keeps a common denominator (of the dissimilarity index) for WN, OS and ST (i.e., the denominator is based on all links of the pair of webs instead of on subsets). Thus, only the numerator of the dissimilarity index is partitioned, which ensures additivity directly by partitioning the sets of links (or link weights).

proportions

Should data be standardized to proportions before calculating quantitative dissimilarity metrics? Note that this is done here directly before calculating dissimilarities, thus gives a different result than if input data were already standardized. Will be set to TRUE by default if binary=FALSE and to FALSE otherwise.

function.dist

Which function to use for calculating dissimilarity? The name of vegan package function, either vegdist (quantitative indices available) or betadiver (gives compatibility to the 24 numbered indices of Koleff et al. (2003) as used by betalink package, but only binary indices). Note that this argument is ignored if partitioning="commondenom", which implements the dissimilarity index calculation directly.

distofempty

Can be zero or na. How should dissimilarity be defined when there are either no links to use for OS (i.e. only links involving species just found in one of the 2 webs) or no links to use for ST (i.e. only “rewiring links” present)? zero is appropriate when interested in the contribution of components OS and ST, whereas na is appropriate when b_os should be interpreted separately as dissimilarity of shared species subwebs

partition.st

A secondary partitioning of the species turnover component, following Novotny (2009), which separates ST further into dissimilarity due to absence of resource species (lower, ST.l), absence of consumer species (higher, ST.h) or absence of both (ST.lh)

Only works with partitioning="commondenom".

partition.rr

A secondary partitioning of dissimilarity (WN and OS) into “true” turnover components (WN.repl, OS.repl) and a component due to richness difference (difference in network totals; WN.rich, OS.repl). This follows Legendre (2014, and references therein) and was first applied to networks by Noreika et al. (2019). The function implements “Podani family” indices according to Legendre's terminology.

Only works with partitioning="commondenom".

...

Arguments passed on to betalinkr.

Details

The basic idea to calculate dissimilarity (betadiversity) between networks (links instead of species) has been proposed before. Poisot et al. (2012) came up with the idea to separate between rewiring and species turnover as causes of network dissimilarity (but see Novotny 2009). They proposed to calculate rewiring link dissimilarity (“beta_OS” or simply “OS”) by focusing on the sub-web containing only species observed in both webs (i.e. excluding links with species unique to one of the webs). Species turnover link dissimilarity (“beta_ST” or simply “ST”) is then calculated as total dissimilarity minus rewiring dissimilarity, but this assumes an additivity that is rarely given with dissimilarity indices. Although dissimilarity values may not be additive, the number of “unique links” (i.e. only observed in one of the two webs) can be well partitioned into additive components.

With option partitioning="poisot", many different dissimilarity indices can be used with function.dist either vegdist or betadiver, but no guarantee that all of them can be usefully interpreted (following Legendre 2014, Jaccard-family and Sorensen-family dissimilarity indices are recommended; note that with vegdist you get Sorensen-family with bray, and with betadiver Jaccard is 15 and Sorensen is 1, although these go under different names there as Koleff et al. (2003) use the names Jaccard/Sorensen for the corresponding similarity metrics).

The alternative approach (with partitioning="commondenom") was inspired by Legendre (2014). It avoids using an existing dissimilarity function, but rather implements calculation of dissimilarity indices directly (thus more limited options for these: only binary and quantitative Jaccard-type and Sorensen-type). Here, the same denominator as for the total dissimilarity WN is used also for its components OS and ST, thus ensuring additivity. This method was actually already proposed by Novotny (2009), who further splitted ST (see partition.st). If your goal is indeed to partition dissimilarity into its (additive) components, use this method!

Note that if you are interested only in dissimilarity between subwebs (not as an additive component), you should use partitioning="poisot" and look at OS while ignoring ST. This works also for quantitative data (with binary=FALSE). If this is your goal, you should probably set distofempty="na", returning NA/NaN if there are no interactions between shared species.

To generate results identical to Poisot's betalink function in package betalink, use these settings: partitioning="poisot", function.dist="betadiver", distofempty="na" and binary=TRUE.

Again: the output for OS can differ strongly depending on the chosen options! You have to decide: do you want dissimilarity, which is inherently not additive (use partitioning="poisot"), or do you want an additive dissimilarity component, which is not a dissimilarity itself (use partitioning="commondenom")?

Value

A named vector of four (or more) dissimilarities (components), naming follows Poisot et al. 2012.

S

beta_S, the dissimilarity in species composition

OS

beta_OS, the dissimilarity (component) explained by “rewiring” among shared species

WN

beta_WN, the dissimilarity between the two networks

ST

beta_ST, the dissimilarity (component) explained by difference in species community composition

(others)

possibly more elements, same names as above, but with secondary partitioning added after “.”, see partition.st and partition.rr

For betalinkr_multi, output is a dataframe with one row per pair of webs compared.

Note

This function allows to use quantitative dissimilarity indices, which are usually recommended. However, for quantitative networks it is far from trivial how to correctly separate (or even define) which part of the dissimilarity is due to rewiring and which due to difference in species composition! Here I use the concept that all variation between the subwebs of shared species can be attributed to rewiring, BUT this will most likely not be correct. Even if all species are shared among two networks, quantitative species dissimilarity may be large (different [relative] abundances), and this will most likely lead to changes in network frequencies (changing link weights, or even missing links) that should not be called rewiring. How to correctly define and measure that is open to discussion, but thus I would still consider the values for beta_OS as overestimates.

This function should also work for one-mode networks.

Why the name of the function? Short for “betalink revised”.

Why the names of the output values? These are the indices of beta (for betadiversity); I am keeping the names used by Tim Poisot and guess what they stand for: S (Species), OS (Only Shared species links), WN (Whole Network links), ST (Species Turnover links). Some authors would call all this dissimilarity (or dissimilarity components) and reserve the term betadiversity for something not standardized between 0 and 1.

For partitioning into replacement and richness difference, note that replacement in WN can mean richness difference in OS (if shared species switch from interaction with other shared species in one network to interactions with non-shared species in another network, changing the size of shared-species subweb), so finding OS.rich > WN.rich is not a bug.

Thanks to Carsten Dormann, Benjamin Schwarz, Benoit Gauzens, Nacho Bartomeus and Timothee Poisot for their contributions to this function.

Author(s)

Jochen Fründ

References

Poisot, T., E. Canard, D. Mouillot, N. Mouquet, D. Gravel, and F. Jordan. 2012. The dissimilarity of species interaction networks. Ecology Letters 15, 1353–1361.

Legendre, P. 2014. Interpreting the replacement and richness difference components of beta diversity. Global Ecology and Biogeography 23, 1324–1334.

Koleff, P., Gaston, K.J., and J.J. Lennon. 2003. Measuring beta diversity for presence–absence data. Journal of Animal Ecology 72, 367–382.

Novotny, V. 2009. Beta diversity of plant-insect food webs in tropical forests: a conceptual framework. Insect Conservation and Diversity 2, 5–9.

Noreika, N., Bartomeus, I., Winsa, M., Bommarco, R., and E. Öckinger. 2019. Pollinator foraging flexibility mediates rapid plant-pollinator network restoration in semi-natural grasslands.Scientific Reports, 9, 1–11. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1038/s41598-019-51912-4")}

See Also

vegdist and betadiver for vegan package functions calculating dissimilarity / betadiversity, used here unless partitioning="commondenom".

For reshaping web data to the array input format expected here, see webs2array and frame2webs.

Examples

# two examples that give the same results as would the 
# \code{betalink} function in the package of the same name
betalinkr(webs2array(list(Safariland=Safariland, vazarr=vazarr)), 
    partitioning="poisot")
betalinkr(webs2array(list(Safariland=Safariland, vazarr=vazarr)), 
    function.dist="betadiver",index=1, partitioning="poisot")

# same data, with recommended partitioning method plus further partitioning
betalinkr(webs2array(list(Safariland=Safariland, vazarr=vazarr)), 
    partitioning="commondenom", partition.st=TRUE)

# another example (no shared links)
testdata <- data.frame(higher = c("bee1","bee1","bee1","bee2","bee1","bee3"), 
  lower = c("plant1","plant2","plant1","plant2","plant3","plant4"), 
  webID = c("meadow","meadow","meadow","meadow","bog","bog"), freq=c(5,1,1,1,3,7))

# more than two webs:
betalinkr_multi(webs2array(Safariland, vazquenc, vazarr), index="jaccard")

bipartite documentation built on May 29, 2024, 2:23 a.m.