Log tracking changes, bug fixes and new functions in bipartite
1.18 (release date: 06-Sep-2012)
fd computes the functional diversity for the rows of a web as a measure of ecological niche complementarity (Devoto et al. 2012). Function written and provided by Mariano Devoto.
fd is also included in the computation of
to compute c- and z-values of the higher trophic level for modular networks. Requires a successful identification of modules through
computeModules. These can then be used to identify connector species in a network.
Thanks to Dirk Raetzel, whose smart improvement made this function orders of magnitude faster! (Amazing how a total of 7 lines of code in a total of over 300 for this function can make such a vast improvement!)
Thanks to Juan M. Barreneche, whose smart improvement made this function orders of magnitude faster while using dramatically less memory.
Use method="external" to impose a specific sequence of exterminations onto the function. Provide this sequence as an index vector (e.g.
c(4,2,3,1)) through the argument ext.row or ext.col (for lower and higher species level, respectively). Requested/proposed by Matt Koski. (Implementation is far from elegant and will be cleaned up in a future version.)
The user is now able to use user-defined colours (def.col) for interaction ranks (square="d"). Thereby the number of interactions can define the colour of the cell in the plot. Makes visweb-plot prettier.
robustness sometimes interpreted wrongly which trophic level was subject to simulated extinction. That was easy to fix. En route, however, I also discovered unexpected behaviour in the
second.extinct function: it gobbled up the last species to be removed from the web. I do not think that extinction slope estimates are affected much, but robustness results may well be exhibiting a bias towards 0.5! Thanks to Silvia Santamaria for reporting this!
Functions always used unweighted networks for computing betweenness and closeness. The default is now to use weighted information, an option which can be switched off. Thanks to Michael Pocock for reporting and suggesting a fix! (Notice the help file for these functions and the large effect that the choice of settings can have on the results!)
Failed to work for networks with empty columns or rows. These will now be deleted (with a warning) before the analysis. Thanks to Julien Renoult for reporting.
Failed to work for networks with only one column or row. Thanks to Zhijiang Wang for reporting.
Caused an error if a selection of indices was provided.
Web asymmetry was explained the wrong way around (thanks to Bernhard Hoiß for reporting!) and there was some confusion in the help for whether quantitative or weighted-quantitative indices were implemented (Yvonne Fabian for correcting the clarification!).
1.17 (release date: 20-AUG-2011)
Computes the Paired Differences Index proposed by Poisot et al. (2011a,b). Also automatically now included in
Computation of betweenness was causing an error when the network was containing a single-link compartment. Thanks to Marco Mello for spotting!
This paper compares specialisation indices, based on the function
specieslevel. All source code to reproduce these results is included. It can serve as a guide to the
specieslevel function and its interpretation.
1.16 (release date: 29-May-2011)
1. Sometimes d.min was larger than d.raw yielding negative d'-values. Since the search for d.min is heuristic, it can sometimes fail to yield lower values than d.raw. In these (rare) cases, d.min is now set to d.raw. 2. Documentation for a specific (but not uncommon or unreasonable) constellation added: When independent abundances were provided, the empty rows/columns are purposefully not removed from the web (because they now still contain information). Logically (and as implemented), this leads to d-values for these species of NA. This makes sense: the pollinator, say, has never been observed on any of the flowers, so how can we quantify its specialisation? While reasonable, it was undocumented behaviour. Thanks to Ana María Martín Gonzáles for drawing our attention to it!
Thanks to Paul Rabie, a faster implementation of the
shuffle.web null model is available. Choosing the option legacy=FALSE will deliver the null models about 3 times faster.
1.15 (release date: 05-Mar-2011)
Occasionally, an interaction too many was swapped, leading to a connectance slightly too low compared to the original matrix. Spotted and reported by Sven Hanoteaux. (For “normal” webs, this bug has luckily caused only very small discrepancies between the realised and the intended null web. We thus regard this error to be (luckily) of virtually no influence on the results reported in our Open Ecology Journal paper. Please also note that the help of
swap.web recommends using
Some interactions were lost when there were more rows than columns. Spotted and reported by Sven Hanoteaux. (Please note that while a shameful mistake, it luckily does not affect the results reported in our Open Ecology Journal paper, where all webs analysed were asymmetric “in the right way”.)
No output was provided when only index “Fisher alpha” or “mean interaction diversity” was selected. Thanks to Sven Hanoteaux for reporting and fixing!
1.14 (release date: 21-Dez-2010)
A plotting function to go with the
PAC-function, providing a nice circularly arranged bubble plot, which has been copied (in style) from Morris et al. (2005). Various colour options are available.
Gustavo Carvallo has updated the existing function
nestednodf in vegan to compute a weighted (quantitative) version as proposed by Ulrich & Almeida Neto (2011 Env. Mod. Soft). This is now linked into bipartite.
bezerra2009 is a“full” flower-visitation network of oil-collecting bees in Brazil. See help for details.
The newly (1.13) added functionality for index “weighted closeness” did not work for webs without column and row names (such as null models). Also “weighted betweenness” was occasionally playing up.
Betweenness and friends cannot be computed for fully compartmented webs (i.e. where each species interacts only with its own partner in the other trophic level). The function then failed instead of returning NA. Thanks to Nadine Sandau for reporting.
When providing independent abundances, the computation of dmin was sometimes incorrect (particularly for small webs) due to a typo. Fixed by Jochen Fründ.
When provided with 3 or less point to compute the degree-distribution fit from now immediately returns NA-filled matrices. Saves the time of going through all starting values and still failing.
The former quantitative did not really reflect what it does, so it was changed to weight.column.
Robustness and weighted nestedness were wrapped in
try-functions (for very small networks).
This is still experimental and proper references etc. will be added after testing! Please do not use for production yet (at least not without consultation). Thanks to Rouven Strauß for developing this.
1.13 (release date: 29-Sep-2010)
to compute H2' for non-integer web. Thanks to Jochen Fründ for providing the inspiration and the code. This option is also now available in
Upon using the modification entered in version 1.12, it turns out this is no improvement but rather a step in the wrong direction. So this function is back to its pre-1.12 working with a little bug fixed in swap.web (the helper function ‘upswap’ got an option too many) that caused the alteration in the 1.12 version. Thanks to Jochen Fründ for insisting on rolling this back.
Alatalo interaction evenness could not be called separately due to a change of name within the function. Thanks to Rachel Gibson for reporting!
In addition to the binary cluster coefficient, the function now also (and automatically) computes the weighted clustering coefficient introduced by Tore Opsahl in his package tnet.
Transforms a web-matrix into an edge list, as used in tnet or other software (e.g. Pajek).
1.12 (release date: 21-May-2010)
In very poorly sampled networks,
vaznull could fail because after the initial filling there were no more interactions to distribute. How an if-statement can sometimes make a difference.
nullmodelchanged to a warning.
Up to this release, the function created null models as specified. However, when a supposedly quantitative network was in fact binary, it returned an error. Now it proceeds, using the null model generating algorithm “mgen”, and returns a warning.
1.11 (release date: 10-May-2010)
Gains options to do projections of the bipartite (=two-mode) into the one-mode modus required e.g. by sna. In most publications, one focusses on only one trophic level (e.g. the pollinators) and represents the bipartite network as a one-mode, pollinators-only network. This can now be achieved using the various options in the function. See its help for details.
Upon re-reading the paper motivating the inclusion of these functions, I noticed an error in the previous implementation. The key point, and one that is contentious in network theory, is that there is no standard best way to project a two-mode (bipartite) network onto a one-mode network. Up until know, I used the default of
as.one.mode. However, Martín Gonzáles et al. (2010) use the more common projection (“higher” and “lower”, respectively), and this is also now implemented in
CC. The interested reader may want to follow this problem up by reading the pre-print of Tore Opsahl (“Triadic closure in two-mode networks”) to see that this one-mode projection actually distorts the statistics employed on them.
1.10 (release date: 02-May-2010)
Fits a lognormal or negative binomial distribution to the marginal totals of a network and then draws random values from the thus specified distribution. These values represent the marginal totals to be used for constructing a null model network. The function thus serves as a way to produce null models without maintaining exactly the marginal totals, but only their distribution. Please refer to the help for some cautionary remarks on its use! In particular, null model networks are likely to be smaller than the original and there is obviously no guarantee that the marginal totals are actually distributed in the specified way!
All species in these 8 networks are now consistently named (rather than numbered).
Requesting Fisher's alpha sometimes causes convergence problems in the underlying function. This is now caught by a try, returning NA.
nestedgave wrong scaling for NODF:
1.09 (release date: 22-Mar-2010)
Degree distributions for the higher trophic level were calculated incorrectly. The main problem was that the scaling constant was omitted, leading to ridiculous fits. (Thanks to Roberto Molowny for reporting, correction proposal and discussion!) On improving this, I also ventured to provide multiple starting values and hence the function returns a fit for all three curves more often (but not always).
1.08 (release date: 16-Mar-2010)
Rows and columns were mixed up and a +1 was missing- oh dear. (Thanks to Marco Mello for reporting!)
1.07 (release date: 18-Feb-2010)
Null model with constrained totals and connectance proposed by Diego Vázquez, similar to
swap.web, but “better”. See notes in
swap.web-help for justification of this statement. We recommend this null model for constraining both marginal totals and connectance.
So far, random extinction sequences and the rarest-to-commenest sequence were implemented. Now,
second.extinct also includes the option method="degree" to build a sequence from the best-to-least connected species. This is the most extreme case, where the most generalist species goes extinct first (see Memmott et al. 1998). (In response to request by Simone Bazarian.)
Now includes the new vaznull as a method (3). This leads to changes in the sequence of methods! Old code may hence have to be adapted accordingly!
1.06 (release date: 18-Dec-2009)
Simple functions to calculate normalised degree, betweenness centrality and closeness centrality. These functions and the example allows a reproduction of the type of analysis carried out in Martín González et al. (2009).
, which now calls
now allows also data.frames to be turned into one-mode-style representations. Previously, only matrices could be used.
When used on a full network (i.e. one without zeros), some indices in
networklevel are undefined (e.g. extinction slopes). This led to a long output of warning and error messages, although internally I used the try-function to capture errors. Now, these messages are suppressed.
1.05 (release date: 05-Dec-2009)
and its suggestions for the interpretation downright wrong. Thanks to Matthew Wainhouse for reporting and simplifying it!
This occurred when detaching the package (
detach(package:bipartite)) and was caused by somehow wrongly using
.Last.lib. Deleting it solved the problem.
Calling this function with only one index caused it to return empty lists. Simple mistake, but better without it.
1.03 (release date: 06-Nov-2009)
A small mistake for a human, but a huge bug for mankind. Sorry. (Detail: I forgot to square sigma.i, leading to strange results.) Thanks to Giorgio Mancinelli for reporting!
NULL when an index was selected that does not exist (e.g.
"shannon diversity" instead of
"diversity"). Now, a helpful (?) error message is returned.
After a fruitful discussion with Becky Morris and Jason Tylianakis, I changed the default to
"sum". I also reproduce some of our communication in the help to this function, under details, to make the ecological assumptions behind either option a bit more transparent. There are good reasons for either option.
1.02 (release date: 11-Sep-2009)
Now more trophic networks can be plotted by staggering bipartite networks on top of each other. See multitrophic examples in
This function did not return exactly the values of the website-version. Jochen Fründ corrected this. Please read the help of the function (final paragraph) for details.
This convenience function collects the various ways to calculate nestedness of a network in order to facilitate comparison of nestedness analyses. To do so, it heavily borrows from vegan.
Would return a silly value (half of the number of rows) for empty matrices. This had no effect when called by
networklevel, since the matrix would have been emptied. Thanks to Roberto Molowny for reporting!
Due to a missing space, the option ALLBUTDD did not work properly. Thanks to Etienne Laliberte for reporting!
1.00 (release date: 06-Aug-2009)
After a workshop on bipartite networks in ecology, a few more indices were added (Fisher's alpha diversity of interactions, mean interaction diversity, mean number of predators) and the whole output reorganised. It now follows a gradient from less to more interesting (in our view) indices, and from indices for binary to those for quantitative networks. Also, I added several options for which indices to report (index="info", "binary", "quantitative", "topology"). Most interestingly, perhaps, there is now a quantitative, Shannon-based series of indices. Starting with the “mean interaction diversity” (i.e. the Shannon-diversity of interactions of a species, averaged across all species in that trophic level), over “Shannon diversity” of interactions, to H2 (i.e. Shannon diversity scaled between max and min possible for this web characteristics).
Similar to the above item, some indices were added, and the output simplified when calling the option index="ALLBUTD" (only one D here!): a list with two matrices is now returned. Fisher's alpha for each species, vulnerability/generality and effective number of species for each target species are also now included. Index sequence has changed.
Calculates the Potential for Apparent Competition following the formula in Müller et al. (1999) and Morris et al. (2005) and the suggestion by Becky Morris and Owen Lewis. More than a theoretical concept, it was experimentally shown to be relevant (Morris et al. 2004).
A line of code went missing at some point, so the maximum packing density was not optimal (but still good) in these functions. As a result, reported H2- and d-values were sometimes 0 when they should be only very close to 0.
By default now suppresses error reporting when
nls fails to fit a degree distribution due to too few data points. This leaves the user of
networklevel somewhat less confused. Warning message now also indicates for which trophic level there were too few data points.
Failed when the web was very dense or very sparse, because the maximum number of checkerboard patterns was 0 then.
0.94 (release date: 01-Aug-2009)
A convenience wrapper function to generate different types of null models.
This function returns a list of indices. If we exclude the computation of degree distribution fits, this would be coerced to a vector. We added the option index="ALLBUTDD" to calculate all indices BUT degree distributions. The output is then returned as vector. This is much more convenient when using networklevel on many data sets (using
0.93 (release date: 30-Jun-2009)
The function always selected column 3 of the object, instead of 2 for lower and 3 for higher trophic level; thanks to Antonio Rivera for spotting and reporting this error! Notice that this error must have slipped in somewhere around version 0.90/0.91, because I checked and the results reported in the Open Ecology Journal paper are valid! I seem to remember that I (CFD) modified
robustness was added: never change a wining team!
0.92 (release date: 02-Jun-2009)
the arguments box.border and box.col now allow a specification of the colour of the boxes and their borders.
the function returned 0 for a 1x1 matrix. Although not written for such a case, it should still do what it says on the tin. Thanks to Mariano Devoto for spotting and reporting!
returned NA for square matrices.
gave decimal places for row and column names for very small networks.
0.91 (release date: 06-May-2009)
This function replaces the (now deprecated) function
nestedness.corso in calculating a (weighted) nestedness for bipartite networks. It was developed and implemented by Marcelino de la Cruz, Juan M. Pastor, Javier Galeano and Jose Iriondo. It is also called by
networklevel. A plotting function is also available, depicting the contributions of each observed link to the web's nestedness. -
nestedness.corso is now removed from the package. The main reason is that it served as an interim solution for
wine, and the Corso-way of calculating nestedness is just one more of already too many. If you intend to use
wine on binary data and interpret that as a Corso-equivalent, beware of the following two main differences (thanks to Jose Iriondo for summarising them): First, the nestedness of Corso et al. varies between 0 and 1, with the highest nestedness is reached at 0 and 1 corresponds to random, whereas in
wine is just the opposite (this is because the Manhattan distances are calculated with regard to opposite sides of the matrix). Secondly, the ‘d’ in the nestedness of Corso is the sums of the ‘dij’s whereas in
wine, the ‘d’ (= ‘win’ value of the object produced by
wine) is the average of the ‘dij’s above 0. So, we recommend NOT to use wine for calculating Corso's nestedness, but rather download the source code for
nestedness.corso from an older version of bipartite.
A better way to quantify the effect of species loss on the extinctions in the other trophic level; kindly provided by Mariano Devoto. This index is also part of
Another quantitative pollination network from the NCEAS database (see
0.90 (release date: 24-Mar-2009)
We added several new functionalities mainly to be able to analysis data and use network statistics as suggested by
Vázquez et al. 2009. You can access this example by typing
Can now plot different sized circles to represent interactions, as proposed by Vázquez et al. (2009).
We added an option to calculate interaction evenness either based on all possible links or just on realized links.
Can be used to sort webs in different ways.
Another pollination network from the NCEAS database (see
We replaced the CA-based approach to detecting compartments by a comprehensive and recursive approach. The latter is not affected by ties in the data set (i.e. species with the same number of links). In quantitative webs and for the networks included in bipartite, the old function was working fine, but in more recent trials it failed to detect 2-species compartments. In turn, we had to adapt
0.85 (release date: 10-Mar-2009)
New feature: text labels can now be printed in different colours. All colours can be passed as vectors and vectors are recycled if not of appropriate length
0.84 (release date: 25-Feb-2009)
New feature: arrow=“center.up”, arrow=“center.down”, arrow=“center.both”: this results in the standard presentation of bipartite networks, where interactions are displayed as centered triangles.
0.83 (release date: 9-Feb-2009) pdf of OEJ-paper added as vignette
0.82 (release date: 27-Jan-2009)
Two new features: 1. colors of borders of boxes and interactions can be specified via setting bor.col. 2. Labels can now be rotated by specifying text.rot=90.
0.81 (release date: 06-Jan-2009)
nodespecreplaces the now obsolete function
The inventor of functional specialisation, Bo Dalsgaard, understands the term ‘functional specialisation’ to be restricted to the way in which plants are specialised to pollinators. Although I disagree (and think that ‘functional’ actually means very little until defined for a given problem), I renamed the ‘functional specialisation index’ into ‘node specialisation index’. This is not a particularly clever name, but at least it indicates that the position of nodes in a network is important when it is calculated.
nestedness.corso overwrote results of
Very small webs should probably not be used at all for testing theories!
Indices are usually VERY sensitive to the exact number of species, number of observations etc. Still, sometimes we simply want to calculate some index, and then bipartite should handle such small networks, too. So, when going through several dozens of very small webs (sometimes only containing one species in one of the two trophic levels), several functions did not perform correctly (usually to such minor programming issues such as matrices being converted to vectors when
[ was used with drop=TRUE, i.e. the default). Changes affected the functions
empty. Their output remains identical, only they now also work for small webs.
Galeano et al. do not describe how to deal with ties, nor do they make clear if the packed matrix should be sorted by marginal sum of links or marginal sum of interactions! Previously, we used marginal sum of interactions (because it is a weighted index), but now we moved to marginal sum of links, because that is how I interpret their paper after a third (or forth) re-reading. Furthermore, because the real maximum chaos cannot be derived (to my knowledge) algorithmically, we use the 95% quantile of 500 randomisations as maximum. This will lead to a consistently overestimated nestedness, but it is less sensitive to the number of replicates than the max. (Also, there was an error in the description of the value returned: 0 is nested, 1 is chaos!)
0.8 (release date: 21-Dec-2008)
Function didn't work correctly when the web contained more rows than columns. (Thanks to Anna Traveset for spotting and reporting!)
Sometimes additional information is available and species can be included in a network, although they have no interactions with other species. In this case, one might want to use these species in the network, too. A new option (empty.web), allows to keep empty rows and columns, although for some functions an emptied web must be used (e.g. degree distributions).
As in the last
H2fun bug fix, sometimes H2 became negative.
Shannon diversity is based on the log of interactions. If this value is 0, as it is for most network entries, an NA is produced. As a consequence, Shannon's H (now also given in output) is based not on all interactions, but only those > 0. In consequence, Shannon evenness should also only be SH divided by the number of realised interactions (
log(sum(web>0))). That is now the case.
0.74 (release date: 24-Oct-2008)
functspec) bug fix
Paths were double the true length, hence minimum was 2, rather than 1.
Since the search for H2min is heuristic, H2uncorr can sometimes be lower than H2min; in that case, H2fun returned a value greater 1, while it should be one exactly.
Calculates (weighted) nestedness according to Corso et al. (2008) and Galeano et al. (2008).
Calculates discrepancy according to Brualdi & Sanderson (1999), deemed to be best ever measure of nestedness; also gives an example for a binary null model analysis based on vegan's
Correction of several minor typos on the help pages; removal of "~" in help files; same citation style throughout; new cross references (especially for the nestedness functions); in
networklevel, nestedness is now calculated using vegan's
nestedtemp due to matrix inversion problems reported for binmatnest.
0.73 (release date: 1-Sept-2008)
Named abundance-vector for each level can be used.
For plotting tripartite networks.
0.72 (release date: 12-June-2008)
See Dalgaard et al. (2008).
Allows calculation of path lengths, centrality, betweenness and other indices developed for one-mode networks.
plotweb when no species labels were given.
This function is only invoked for its side effect of opening the help page. I simply didn't know how to do it any other way ...
Carsten F. Dormann <firstname.lastname@example.org>