NODF: Nestedness metric based on overlap and decreasing fill

View source: R/nodf.r

NODFR Documentation

Nestedness metric based on overlap and decreasing fill


The procedure calculates the “nestedness metric based on overlap and decreasing fill” (NODF) for a binary matrix following Almeida-Neto et al. (2008).


NODF(dataset, print.results= TRUE)



Object of class RInSp with data of type “double” or “integer”.


Define if results for NODF should be printed. Default is TRUE



Nestedness is a feature of binary matrices (also called presence/absence or incidence matrices). The notion of nestedness is particularly relevant for studies focusing the patterns of species occurrence among a set of locations (e.g., islands) and the patterns of interacting species within ecological networks.

Almeida-Neto et al. (2008) propose a nestedness metric is based on two simple properties: decreasing fill (or DF) and paired overlap (or PO). Assuming that in a matrix with m rows and n columns, row i is located at an upper position from row j, and column k is located at a left position from column l. In addition, let MT be the marginal total (i.e. the sum of 1's) of any column or row. For any pair of rows/columns i and j, DF_{ij} will be equal to 100 if MT_j is lower than MT_i. Alternatively, DF_{ij} will be equal to 0 if MT_j is greater or equal to MT_i. For columns/rows, paired overlap (PO_{kl}) is simply the percentage of 1's in a given column/row l that are located at identical row/column positions to those in a column/row k. For any left-to-right column pair and, similarly, for any up-to-down row pair, there is a degree of paired nestedness (N_{paired}) as zero if DF_{paired} is zero, and PO if DF_{paired} is 100.

From the n(n-1)/2 and m(m-1)/2 paired degrees of nestedness for n columns and m rows, we can calculate a measure of nestedness among all columns (N_{col}) and among all rows (N_{row}) by simply averaging all paired values of columns and rows.

Finally, the measure of nestedness for the whole matrix is given by:

NODF = \frac{∑{N_{paired}}}{(\frac{n(n-1)}{2})+(\frac{m(m-1)}{2})}

In the context of studies of individual specialization, one form of diet variation arises when individuals differ in their niche breadth, such that some individuals diet is a subset of other individuals' diet. This is revealed by a nestedness metric, which may be large (indicating nesting) or small (indicating clustering).


The result is a list of class ‘RInSp’ composed of:


Value of the index of nestedness.


Value of the index of nestedness for rows.


Value of the index of nestedness for columns.


Binary matrix with individuals as rows and resources as columns. This matrix can be imported into the software PAJEK ( to draw a binary bipartite network of diet connectance between individuals (one set of nodes) and resources (a second set of nodes).


The degree of nestedness observed for rows.


The degree of nestedness observed for columns.




Almeida-Neto M., Guimaraes P., Guimaraes P.R., Loyola R.D., and Ulrich, W. 2008. A consistent metric for nestedness analysis in ecological systems: reconciling concept and measurement. Oikos 117: 1227-1239.

See Also

For further indices see the R package “vegan”. Please consider that the NODF implementation lacks the ordering and weighting options of nestednodf available in “vegan”.


# NODF example with stickleback data from Bolnick and Paull 2009
# Select a single spatial sampling site (site D)
SiteD <- import.RInSp(Stickleback, row.names = 1, info.cols = c(2:13),
subset.rows = c("Site", "D"))
Nesting <- NODF(SiteD)

RInSp documentation built on May 20, 2022, 9:06 a.m.