Skip to contents

This function is an implementation of the niche model (Williams & Martinez, 2000) which generates food webs based on three elements:

  • a number of species,

  • a niche axis and

  • a value of connectance.

Usage

fw_niche_model(
  nsp,
  connectance,
  connect_all = FALSE,
  unbias = FALSE,
  niche = NULL
)

Arguments

nsp

An integer giving the number of species considered.

connectance

A real positive between 0 and .5 indicating the connectance of the network to be generated.

connect_all

Logical. If TRUE, then all species in the network have a least one prey (but the niche with the lowest niche value).

unbias

Logical. If TRUE, then the first species may not be a basal species.

niche

A vector real positive between 0 and 1 standing for the niche axis. Default is set to NULL, in such case the niche axis is automatically generated.

Value

A logical matrix describing pairwise interactions. A given line describes the diet of a given species while a column describes the set of predator associated to a particular species.

Details

Three remarks. First, according to Williams and Martinez (2000), the species with the lowest niche value is considered as a basal species and therefore cannot feed upon another species. This introduces a slight bias (e.g the expected connectance is lower than the expected values connectance). Second, forcing all the species to be connected introduces another bias (on connectance values) as they tends to be more connected than expected. Third, if with custom niche axes, the expected connectance may not be the one expected (connectance) as niche values distribution will likely differs from the uniform distribution used in Williams and Martinez (2000).

References

Williams, R.J. and Martinez, N.D. (2000) Simple rules yield complex food webs. Nature, 404:180–183.

Examples

fw_niche_model(10, 0.2)
#>        [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10]
#>  [1,] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [2,] FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [3,]  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [4,] FALSE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [5,] FALSE FALSE  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE
#>  [6,] FALSE FALSE FALSE FALSE  TRUE  TRUE  TRUE FALSE FALSE FALSE
#>  [7,]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE
#>  [8,] FALSE FALSE FALSE FALSE  TRUE  TRUE FALSE FALSE FALSE FALSE
#>  [9,] FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE
#> [10,] FALSE FALSE FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE