# Trophic levels

### Description

Functions that compute different measures of trophic level.

### Usage

1 2 3 4 5 6 7 8 9 10 | ```
PreyAveragedTrophicLevel(community, include.isolated=TRUE)
FlowBasedTrophicLevel(community, weight.by, include.isolated=TRUE)
ShortestTrophicLevel(community, include.isolated=TRUE)
ShortWeightedTrophicLevel(community, include.isolated=TRUE)
LongestTrophicLevel(community, include.isolated=TRUE)
LongWeightedTrophicLevel(community, include.isolated=TRUE)
ChainAveragedTrophicLevel(community, include.isolated=TRUE)
TrophicHeight(community, include.isolated=TRUE)
TrophicLevels(community, weight.by=NULL, include.isolated=TRUE)
``` |

### Arguments

`community` |
an object of class |

`include.isolated` |
if |

`weight.by` |
the name of a node property, either first-class or computed,
by which to weight flow-based trophic level. Must satisfy the criteria
of the |

### Details

Trophic level is a measure of a node's ‘distance’ from the primary
producers in the community and hence indicates how many steps matter, and hence
energy, has been through to reach that node. Each function (with the exception
of `TrophicLevels`

) returns a vector containing a different measure of
trophic level. These functions follow the definitions of Williams and Martinez
(2004).

`PreyAveragedTrophicLevel`

returns 1 plus the mean trophic level of the
node's resources, using the matrix inversion method of Levine (1980) that is
very fast and accounts for flow through loops. If this matrix inversion fails
then there is an important problem with the network topology and the function
will return a vector containing all `NA`

s. For a food web to be
energetically feasible, every node must be connected to a basal node. When the
inversion fails it is because there is at least one node that has no connection
to a basal node. `FlowBasedTrophicLevel`

also implements the matrix
inversion technique and uses the `weight.by`

node property to provide an
estimate of energy flow through each trophic link.

`ShortestTrophicLevel`

, `ShortWeightedTrophicLevel`

,
`LongestTrophicLevel`

, `LongWeightedTrophicLevel`

and `ChainAveragedTrophicLevel`

compute trophic level by
examining the position of each node in every food chain in which it appears.
`ShortestTrophicLevel`

returns 1 plus the shortest chain length from a
node to a basal species. `ShortWeightedTrophicLevel`

returns the average
of `ShortestTrophicLevel`

and `PreyAveragedTrophicLevel`

.
`LongestTrophicLevel`

is the longest chain length from each node to a
basal species. `LongWeightedTrophicLevel`

is the average of
`LongestTrophicLevel`

and `PreyAveragedTrophicLevel`

.
`ChainAveragedTrophicLevel`

is 1 plus the average chain length of all
paths from each node to a basal species. These five functions each
enumerate every unique food chain (using `TrophicChainsStats`

), which can
be lengthy for complex food webs. If more than one of these five measures of
trophic level is required, it will be faster to use the `TrophicLevels`

convenience function, which enumerates unique food chains only once and returns
a matrix containing every measure of trophic level in columns ‘ShortestTL’,
‘ShortWeightedTL’, ‘LongestTL’, ‘LongWeightedTL’, ‘ChainAveragedTL’,
‘PreyAveragedTL’ and, if `weight.by`

is given, ‘FlowBasedTL’.

Jonsson et al (2005) defined ‘trophic height’ to be the same as
Williams and Martinez' (2004) chain-averaged trophic level so
`TrophicHeight`

is a synonym for `ChainAveragedTrophicLevel`

.

All methods will return a vector containing all `NA`

s if no nodes are basal
i.e., all nodes are cannibalistic or ‘community’ has no trophic links.

### Value

Either a vector of length `NumberOfNodes`

or a `matrix`

with
`NumberOfNodes`

rows.

### Author(s)

Lawrence Hudson and Rich Williams

### References

Jonsson, T. and Cohen, J. E. and Carpenter, S. R. (2005)
Food webs, body size, and species abundance in ecological community
description. Advances in Ecological Research **36**, 1–84.

Levine, S (1980) Several measures of trophic structure applicable to complex
food webs. Journal of Theoretical Biology **83**, 195–207.

Williams, R. J. and Martinez, N. D. (2004) Limits to Trophic Levels
and Omnivory in Complex Food Webs: Theory and Data. American Naturalist
**163**, 63, 458–468.

### See Also

`IsIsolatedNode`

, `IsBasalNode`

,
`IsCannibal`

, `NPS`

,
`TrophicChains`

, `NumberOfNodes`

,
`NumberOfTrophicLinks`

, `TrophicChainsStats`

,
`PredationMatrix`

### Examples

1 2 3 4 5 6 7 8 9 10 11 | ```
data(TL84)
# Six different measures of trophic level
TrophicLevels(TL84)
# The Benguela data contains diet.fraction
data(Benguela)
# Compare prey-averaged and flow-based
cbind(pa=PreyAveragedTrophicLevel(Benguela),
fb=FlowBasedTrophicLevel(Benguela, weight.by='diet.fraction'))
``` |