Calculates a variety of indices and values for a bipartite network
1 2 3 4 5  networklevel(web, index="ALLBUTDD", level="both", weighted=TRUE,
ISAmethod="Bluethgen", SAmethod = "Bluethgen", extinctmethod = "r",
nrep = 100, CCfun=median, dist="horn", normalise=TRUE, empty.web=TRUE,
logbase="e", intereven="prod", H2_integer=TRUE, fcweighted=TRUE,
fcdist="euclidean", legacy=FALSE)

web 
Web is a matrix representing the interactions observed between higher trophic level species (columns) and lower trophic level species (rows). Usually this will be number of pollinators on each species of plants or number of parasitoids on each species of prey. 
index 
One or more of the following (exact match only!). First the group of “pure” network indices, then those computed for each level.
and/or those invoked through
Furthermore, there are some groups of indices that can be called:

level 
For which level should the levelspecific indices be computed: both (default), lower or higher? 
weighted 
Logical; should the weighted average be computed for indices that are averaged across species (at the group level)? Defaults to TRUE. 
ISAmethod 
Method to use for calculating interaction strength (= dependence) asymmetry; original by Bascompte is yielding artefact results based only on the asymmetry of the web (as shown by example in Blüthgen et al. 2007 analytically in Blüthgen 2010) and should hence be avoided; Bluethgen (default) excludes singletons and corrects for low number of interactions (range 1 to 1). 
SAmethod 
How to aggregate d'based specialisation values: mean of logtransformed dependencies (log) or Blüthgen's marginal totalsweighted mean (default); see Blüthgen et al. (2007). 
extinctmethod 
Specifies how species are removed from matrix: random, degree or abundance (partial matching). See 
nrep 
Number of replicates for the extinction sequence analysis. 
CCfun 
Method to use when calculating the clustering coefficient. Originally proposed as mean of cluster coefficients for each species. Defaults to median, because cluster coefficients are strongly skewed. 
dist 
Distance metric to be used to calculate niche overlap. Any of vegan's 
normalise 
Logical; shall the Cscore and togetherness metrics be normalised to a range of 0 to 1? Defaults to 
empty.web 
Shall the empty columns and rows be deleted? Defaults to TRUE. 
logbase 
Shall the various diversity indices (linkage density, partner diversity, generality/vulnerability, interaction evenness) be calculated to the base of e (default) or 2? Log2 is the proposal for generality and vulnerability by Bersier et al. (2002), while Shannon uses ln. The choice of the base will not affect the results qualitatively, at most by a scaling factor. Note that for all these indices, we follow common practice and define 0 * log(0) = 0. 
intereven 
Shall all cells of the matrix be used to calculate the interaction evenness 
H2_integer 
Logical; indicates whether values in web are integers. Passed on to 
fcweighted 
Logical; when computing “functional complementarity” sensu function 
fcdist 
Distance measure to be used to compute functional complementarity through 
legacy 
Logical; should the old (pre2.00) version of 
For explanations of any of the indices computed for a level (i.e. those with HL and/or LL suffix), please see grouplevel
for details.
This function implements a variety of the many (and still procreating) indices describing network topography. Some are embarrassingly simple and mere descriptors of a network's outer appearance (such as number of species in each trophic level or the number of links (= nonzero cells) in the web). Others are variations on Shannon's diversity index applied to within column or within rows. Only extinction slope is newly implemented here, and hence described in a bit more detail.
Currently, you cannot get the qualitative version of quantitative indices such as vulnerability!
Integers or continuous values  what are the quantities in quantitative webs? Some web metrics expect in their typical formulation that the entries in the webmatrix are integers  e.g. H2' is defined relative to minimum and maximum based on marginal totals. Blüthgen et al. (2006) use an algorithm assuming values can only be integers. If your quantities are not constrained to be integers, multiplication and rounding may or may not give consistent results, depending on rounding errors and the factor applied. Multiplication with high numbers such as 10 000 seems to be OK. For H2' a simplified calculation applicable to continuous numbers is available (by declaring option H2_integer=FALSE in H2fun
). Note that values of H2' based on integers are not directly comparable to H2' based on continuous values (for sparse webs, H2'_continuous is much higher than H2'_integer). We tentatively think that other indices are hardly affected by noninteger values or by multiplication and rounding. Please let us know your experience.
The suffixes LL and HL refer to lower and higher level, respectively
Depending on the selected indices, some or all of the below (returned as vector if “degree distribution” was not requested, otherwise as list):
connectance 
Realised proportion of possible links (Dunne et al. 2002): sum of links divided by number of cells in the matrix (= number of higher times number of lower trophic level species). This is the standardised number of species combinations often used in cooccurrence analyses (Gotelli & Graves 1996) 
web asymmetry 
Balance between numbers in the two levels: positive values indicate more highertrophic level species, negative more lowertrophic level species; implemented as 
links per species 
Mean number of links per species (qualitative): sum of links divided by number of species. 
number of compartments 
Compartments are subsets of the web which are not connected (through either higher or lower trophic level) to another compartment. Mathematically, they are Jordan blocks, but this implementation is rulebased (and fast). They are also nicely visualised in the 
compartment diversity 
Shannon's diversity of compartment sizes (size = number of species from both levels); see Tylianakis et al. (2007). 
cluster coefficient 
The cluster coefficient for a network is the average cluster coefficients of its members, i.e. simply the number of realised links devided by the number of possible links. Introduced by Watts & Strogatz (1998) and described in Wikipedia under http://en.wikipedia.org/w/index.php?title=Clustering_coefficient. The cluster coefficient can be computed both for the entire network, as well as for each level (for the latter indicated by suffix HL or LL). 
nestedness 
Nestedness temperature of the matrix (0 means cold, i.e. high nestedness, 100 means hot, i.e. chaos). For details see 
weighted nestedness 
A nestedness version that considers interaction frequencies (and is hence weighted), proposed by Galeano et al. (2007) and implemented in 
weighted NODF 
Another quantitative (=weighted) index for nestedness, building on NODF (see 
interaction strength asymmetry 
(selected using index = "ISA") Explaining dependence asymmetry is also a measure of specialisation, across both trophic levels. Proposed by Bascompte et al. (2006) and critised and alterations proposed by Blüthgen et al. (2007). The latter also show that dependence asymmetry can be almost entirely explained by web asymmetry (see above). Positive values (only possible of ISAmethod = "Bluethgen") indicate higher dependence in the higher trophic level. See function 
specialisation asymmetry 
(selected using index="SA") Asymmetry (higher vs. lower trophic level) of specialisation now based on d' (see 
linkage density 
Marginal totalsweighted diversity of interactions per species (quantitative). Actually, this is computed as the average of vulnerability and generality (Bersier et al. 2002). Does not respond to setting 
weighted connectance 
Linkage density divided by number of species in the network (Tylianakis et al. 2007). This will respond to whether noninteracting species (e.g. unparasitised hosts) are included or not! 
Fisher's alpha 
An alternative measure of interaction diversity (using 
interaction evenness 
Shannon's evenness for the web entries. Note that the two options are rather different. By definition, IE = H/Hmax; H = sum(p.i.mat*log(p.i.mat)), where p.i.mat = matrix/sum(entries in matrix). This means, when calculating H, do we treat all possible links as species, and the interactions (cell values) as measure of their abundance? By definition, Hmax = ln(N). The key question is: What is the right value for N? Since we treat the matrix cells as species, it is (clearly?) the number of matrix cells, i.e. number of higher trophic level species x number of lower trophic level species. We think this logic justifies our default 
Alatalo interaction evenness 
A different measure for web entry evenness, as proposed by Müller et al. (1999). 
Shannon diversity 
Shannon's diversity of interactions (i.e. network entries). 
H2 
H2' is a networklevel measure of specialisation. It ranges between 0 (no specialisation) and 1 (complete specialisation). H2' is a measure of discrimination, i.e. calculated in comparison of no specialisation (see 



others now to come: all other indices are returned as output from 
number of species 

mean number of shared partners 
in this level 
cluster coefficient 
for this level (same for both levels if weighted=FALSE). 
weighted cluster coefficient 

niche overlap 
Mean similarity in interaction pattern between species of the same level, calculated by default as Horn's index (dist="horn"). 
togetherness 
Mean number of cooccupancies across all species combinations. 
C score 
Mean (normalised) number of checkerboard combinations across all species. 
V ratio 
Varianceratio of species numbers to individual numbers within species for that level. 
discrepancy 
Discrepancy as proposed by Brualdi & Sanderson (1999); see 
degree distribution 
See 
extinction slope 
Slope of the secondary extinction sequence in that level, following extermination of species in the other level. 
robustness 
Area below the “secondary extinction” curve; see 
functional complementarity 
for a given level. 
partner diversity 
(Weighted) mean Shannon diversity of the number of interactions for the species of that level. Choose logbase=2 to change to a log2based version. 
generality/vulnerability 
(Weighted) mean effective number of LL species per HL species (generality; HL species per LL species for vulnerability), weighted by their marginal totals (row sums); see Tylianakis et al. (2007) and Bersier et al. (2002). This is identical to exp(“partner diversity”, i.e., simply the Jost (2006)recommended version of diversity. 
Sum or Prod: How to calculate interaction evenness? I shall first put down my argument for “prod” and then Jason Tylianakis' arguments for “sum”.
Carsten: “I do not want to defend a position I cannot hold against the flood of qualified criticism, and shall be happy to change the default to option “sum” (i.e. Jason's proposal). Nevertheless, I shall make a very brief attempt to defend my (and Nico's point of view). Imagine a completely different situation: I have “counted” birds in a landscape. From a more meticulous colleague I know that there are 27 bird species breeding at the moment, but on that two mornings that I went out, I could only hear 15. Now I want to calculate the Shannon diversity (and evenness) of birds in that landscape. The “normal” (in the sense of established) approach to use the data from my 15 species. But hold on: I KNOW there are more species out there. I don't know how many (i.e. there may be more than the 27 my colleague has found), but there are at least 27. If I only use the data from my 15 species, I will get a higher evenness value than when I also include the 12 zeros. My conclusion would be: I don't want to overestimate evenness only because I couldn't look long enough, thus I use all 27 values.”
Jason: “I would disagree because what you “know” is based on your meticulous colleague's ‘sampling’, which will also have its limits. If all you wanted was to know the total number of species there (assuming none have gone extinct), then what you propose is fine. However, the problem comes when you want to compare sites, and then sampling effort should be standardised. In most cases we know we don't have a full representation of the diversity (or food web) of an area, but we know for a given spatial or temporal sampling scale that one site differs from another in certain ways, and to me that is the most important. Anyway, it is all a question of scale and the precise question being asked. So what about making it an option in bipartite that you can either choose to divide by the realised links (give our 2007 paper as a ref, so people know it's comparable to that) or divide by the number of potential links, if that's the question people want to ask?” There you go: it's your choice!
NA values: All error and warning messages are (or at least should be) suppressed! If your web returns and NA for some of the indices, this can be because the index cannot be computed. For example, if the web is full (i.e. no 0cells), extinction slopes cannot be fitted (singularity of gradient). Check if you can expect the index to be computable! If it is, and networklevel doesn't do it, let me know.
Reducing computation time: Some indices require rather long computation times on large webs. If you want to increase the speed by omitting some indices, here a rough guide: Ask only for the indices you are interested in! Otherwise, here is the sequence of most timeconsuming indices:
The slowest function is related to extinction slopes and robustness. Excluding both makes the function faster.
weighted cluster coefficient is also very time consuming (an exhaustive search for 4loops in the onemode projection of the network). Omitting it can dramatically boost speed.
Degree distributions are somewhat time consuming.
Fisher's alpha is computed iteratively and hence time consuming.
Nestedness and weighted nestedness are not the fastest of routines.
Number (and diversity) of compartments calls a recursive and hence relatively slow algorithm.
H2 and specialisation asymmetry require an iterative, heuristic search algorithm. Finally, excluding discrepancy can also moderately decrease computation time.
Carsten F. Dormann carsten.dormann@biom.unifreiburg.de
AlmeidaNeto, M., Loyola, R.D., Ulrich, W., Guimaraes, P., Guimaraes, Jr., P.R. 2008. A consistent metric for nestedness analysis in ecological systems: reconciling concept and measurement. Oikos 117, 1227–1239
AlmeidaNeto, M. & Ulrich, W. (2011) A straightforward computational approach for measuring nestedness using quantitative matrices. Environmental Modelling & Software 26, 173–178
Bascompte, J., Jordano, P. and Olesen, J. M. 2006 Asymmetric coevolutionary networks facilitate biodiversity maintenance. Science 312, 431–433
Bersier, L. F., BanasekRichter, C. and Cattin, M. F. (2002) Quantitative descriptors of foodweb matrices. Ecology 83, 2394–2407
Blüthgen, N. (2010) Why network analysis is often disconnected from community ecology: A critique and an ecologist's guide. Basic and Applied Ecology 11, 185–195
Blüthgen, N., Menzel, F., Hovestadt, T., Fiala, B. and Blüthgen N. 2007 Specialization, constraints and conflicting interests in mutualistic networks. Current Biology 17, 1–6
Burgos, E., H. Ceva, R.P.J. Perazzo, M. Devoto, D. Medan, M. Zimmermann, and A. Maria Delbue (2007) Why nestedness in mutualistic networks? Journal of Theoretical Biology 249, 307–313
Corso G, de Araújo AIL, de Almeida AM (2008) A new nestedness estimator in community networks. arXiv 0803.0007v1 [physics.bioph]
Devoto M., Bailey S., Craze P., and Memmott J. (2012) Understanding and planning ecological restoration of plantpollinator networks. Ecology Letters 15, 319–328. http://dx.doi.org/10.1111/j.14610248.2012.01740.x
Dormann, C.F., Fründ, J., Blüthgen, N., and Gruber, B. (2009) Indices, graphs and null models: analysing bipartite ecological networks. The Open Ecology Journal 2, 7–24.
Dunne, J. A., R. J. Williams, and N. D. Martinez. 2002 Foodweb structure and network theory: the role of connectance and size. Proceedings of the National Academy of Science USA 99, 12917–12922
Galeano, J., Pastor, J.M. and Iriondo, J.M. (2008) WeightedInteraction Nestedness Estimator (WINE): A new estimator to calculate over frequency matrices. arXiv 0808.3397v1 [physics.bioph]
Gotelli, N. J., and G. R. Graves. 1996 Null Models in Ecology. Smithsonian Institution Press, Washington D.C.
Krebs, C. J. 1989. Ecological Methodology. Harper Collins, New York.
Memmott, J., Waser, N. M. and Price M. V. 2004 Tolerance of pollination networks to species extinctions. Proceedings of the Royal Society B 271, 2605–2611
Müller, C. B., Adriaanse, I. C. T., Belshaw, R. and Godfray, H. C. J. 1999 The structure of an aphidparasitoid community. Journal of Animal Ecology 68, 346–370
Roberts, A. and Stone, L. 1990 Islandsharing by archipelago species. Oecologia 83, 560–567
RodríguezGirónes M.A., and Santamaría L. 2006. A new algorithm to calculate the nestedness temperature of presenceabsence matrices. Journal of Biogeography 33, 924–935
Schluter, D. (1984) A variance test for detecting species associations, with some example applications. Ecology 65, 9981005.
Stone, L. and Roberts, A. (1990) The checkerboard score and species distributions. Oecologia 85, 74–79.
Stone, L. and Roberts, A. (1992) Competitive exclusion, or species aggregation? An aid in deciding. Oecologia 91, 419–424
Tylianakis, J. M., Tscharntke, T. and Lewis, O.T. (2007) Habitat modification alters the structure of tropical hostparasitoid food webs. Nature 445, 202–205
Watts, D. J. and Strogatz, S. (1998) Collective dynamics of ‘smallworld’ networks. Nature 393, 440–442
Some functions are implemented separately: H2fun
, second.extinct
, degreedistr
, C.score
and V.ratio
1 2 3 4 5 6  ## Not run:
data(Safariland)
networklevel(Safariland)
networklevel(Safariland, index="ALLBUTDD") #excludes degree distribution fits
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.