Package 'electivity'

Title: Algorithms for Electivity Indices
Description: Provides all electivity algorithms (including Vanderploeg and Scavia electivity) that were examined in Lechowicz (1982) <doi:10.1007/BF00349007>, plus the example data that were provided for moth resource utilisation.
Authors: Desi Quintans [aut, cre]
Maintainer: Desi Quintans <[email protected]>
License: MIT + file LICENSE
Version: 1.0.2
Built: 2025-02-06 05:11:23 UTC
Source: https://github.com/desiquintans/electivity

Help Index


Chesson's alpha, or Vanderploeg and Scavia's selectivity coefficient (W)

Description

These two functions calculate the same value; alpha and W are identical.

Usage

chesson_alpha(r, p, na.rm = TRUE)

vs_select_coef(r, p, na.rm = TRUE)

Arguments

r

(Numeric) Resource utilisation.

p

(Numeric) Resource availability.

na.rm

(Logical) If 'TRUE', 'NA's will be ignored when calculating the selectivity coefficient (W).

Value

A numeric vector.

Examples

data(moth_distrib)

chesson_alpha(moth_distrib$r, moth_distrib$p)
vs_select_coef(moth_distrib$r, moth_distrib$p)

Algorithms for electivity indices and measures of resource use versus availability.

Description

This package is essentially Lechowicz (1982) turned into an R package. It includes all algorithms that were described therein plus the example data that was provided for moth resource utilisation.

Details

Lechowicz, M.J., 1982. The sampling characteristics of electivity indices. Oecologia 52, 22–30. https://doi.org/10.1007/BF00349007

Users are encouraged to read the original paper before deciding which algorithm is most useful for them. Lechowicz recommended Vanderploeg and Scavia's E* index (implemented in this package as vs_electivity()) as "the single best, but not perfect, electivity index" because "E* embodies a measure of the feeder's perception of a food's value as a function of both its abundance and the abundance of other food types present." In practice, he found that all indices returned nearly identical rank orders of preferred hosts except for Strauss' linear index (L).

Author

Desi Quintans (@eco_desi)

URL

https://github.com/DesiQuintans/electivity/


Ivlev's electivity, E

Description

Bounded between -1.0 (avoidance), 0 (random feeding), and +1.0 (preference).

Usage

ivlev_electivity(r, p)

Arguments

r

(Numeric) Resource utilisation.

p

(Numeric) Resource availability.

Value

A numeric vector.

Source

Lechowicz, M.J., 1982. The sampling characteristics of electivity indices. Oecologia 52, 22–30. https://doi.org/10.1007/BF00349007

Examples

data(moth_distrib)
ivlev_electivity(moth_distrib$r, moth_distrib$p)

Ivlev's forage ratio, E'

Description

Bounded between +0.1 (avoidance), +1.0 (random feeding), and infinity (preference).

Usage

ivlev_forage(r, p, log10 = FALSE)

Arguments

r

(Numeric) Resource utilisation.

p

(Numeric) Resource availability.

log10

(Logical) If TRUE, transform the value with log10().

Value

A numeric vector.

Examples

data(moth_distrib)
ivlev_forage(moth_distrib$r, moth_distrib$p, log10 = FALSE)
ivlev_forage(moth_distrib$r, moth_distrib$p, log10 = TRUE)

Jacob's modified electivity, D

Description

Bounded between +0.1 (avoidance), +1.0 (random feeding), and infinity (preference).

Usage

jacob_electivity(r, p)

Arguments

r

(Numeric) Resource utilisation.

p

(Numeric) Resource availability.

Value

A numeric vector.

Examples

data(moth_distrib)
jacob_electivity(moth_distrib$r, moth_distrib$p)

Jacob's modified forage ratio, Q

Description

When logged (which is Jacob's recommendation), bounded between negative and positive infinity.

Usage

jacob_forage(r, p, log10 = FALSE)

Arguments

r

(Numeric) Resource utilisation.

p

(Numeric) Resource availability.

log10

(Logical) If TRUE, return the value as Log10.

Value

A numeric vector.

Examples

data(moth_distrib)
jacob_forage(moth_distrib$r, moth_distrib$p, log10 = TRUE)
jacob_forage(moth_distrib$r, moth_distrib$p, log10 = FALSE)

Distribution of gypsy moth larvae, Lymantria dispar, feeding in a deciduous forest in southwestern Quebec, Canada.

Description

This is Table 2 in the cited source paper.

Usage

moth_distrib

Format

A dataframe with 19 rows and 6 variables:

binomen

Species of tree.

n_indiv

Number of randomly sampled trees.

dbh_cm_sum

Summed diameters at breast height, in centimeters.

larva_mean_sum

Summed numbers of larvae (the means of two counts taken on June 26-27, 1979 and July 3-4, 1979).

r

Relative proportion of larvae feeding on trees (Lechowicz 1982, Equation 2)

p

Estimate of foliage biomass (Lechowicz 1982, Equation 1).

Source

Lechowicz, M.J., 1982. The sampling characteristics of electivity indices. Oecologia 52, 22–30. https://doi.org/10.1007/BF00349007

Examples

data(moth_distrib)

Electivities of gypsy moth larvae

Description

This is Table 3 in the cited source paper.

Usage

moth_elect

Format

A dataframe with 19 rows and 8 variables:

binomen

Species of tree.

E

Ivlev's electivity index.

E_prime_i

Ivlev's forage ratio.

D_i

Jacob's modified electivity.

log_Q_i

Jacob's modified forage ratio, log10.

L_i

Strauss' linear index.

W_i

Chesson's alpha, or Vanderploeg and Scavia's selectivity coefficient.

E_star_i

Vanderploeg and Scavia's relativised electivity.

Source

Lechowicz, M.J., 1982. The sampling characteristics of electivity indices. Oecologia 52, 22–30. https://doi.org/10.1007/BF00349007

Examples

data(moth_elect)

Strauss' linear index, L

Description

Bounded between -1.0 (avoidance), 0 (random feeding), and +1.0 (preference).

Usage

strauss_linear(r, p)

Arguments

r

(Numeric) Resource utilisation.

p

(Numeric) Resource availability.

Value

A numeric vector.

Examples

data(moth_distrib)
strauss_linear(moth_distrib$r, moth_distrib$p)

Vanderploeg and Scavia's relativised electivity, E*

Description

Bounded between -1.0 (avoidance), 0 (random feeding), and +1.0 (preference).

Usage

vs_electivity(r, p, na.rm = TRUE)

Arguments

r

(Numeric) Resource utilisation.

p

(Numeric) Resource availability.

na.rm

(Logical) If TRUE, NAs will be ignored when calculating the selectivity coefficient (W).

Value

A numeric vector.

Examples

data(moth_distrib)
vs_electivity(moth_distrib$r, moth_distrib$p)