Generic function for calculating metacommunity-level diversity.

metadiv(data, qs)

# S4 method for powermean
metadiv(data, qs)

# S4 method for relativeentropy
metadiv(data, qs)

# S4 method for metacommunity
metadiv(data, qs)

Arguments

data

matrix of mode numeric; containing diversity components

qs

vector of mode numeric containing q values

Value

metadiv() returns a standard output of class rdiv

Details

data may be input as one of three different classes:

  • powermean: raw or normalised metacommunity alpha, rho or gamma diversity components; will calculate metacommunity-level raw or normalised metacommunity alpha, rho or gamma diversity

  • relativeentropy: raw or normalised metacommunity beta diversity components; will calculate metacommunity-level raw or normalised metacommunity beta diversity

  • metacommunity: will calculate all metacommunity measures of diversity

References

Reeve, R., T. Leinster, C. Cobbold, J. Thompson, N. Brummitt, S. Mitchell, and L. Matthews. 2016. How to partition diversity. arXiv 1404.6520v3:1–9.

See also

inddiv for type-level diversity and subdiv for subcommunity-level diversity.

Examples

# Define metacommunity
pop <- data.frame(a = c(1,3), b = c(1,1))
pop <- pop / sum(pop)
meta <- metacommunity(pop)

# Calculate metacommunity gamma diversity (takes the power mean)
g <- raw_gamma(meta)
metadiv(g, 0:2)
#>   measure q type_level type_name partition_level partition_name diversity
#> 1   gamma 0      types             metacommunity                 2.000000
#> 2   gamma 1      types             metacommunity                 1.889882
#> 3   gamma 2      types             metacommunity                 1.800000
#>   dat_id transformation normalised  k max_d
#> 1  naive             NA         NA NA    NA
#> 2  naive             NA         NA NA    NA
#> 3  naive             NA         NA NA    NA

# Calculate metacommunity beta diversity (takes the relative entropy)
b <- raw_beta(meta)
metadiv(b, 0:2)
#>    measure q type_level type_name partition_level partition_name diversity
#> 1 raw beta 0      types             metacommunity                0.5555556
#> 2 raw beta 1      types             metacommunity                0.5455618
#> 3 raw beta 2      types             metacommunity                0.5380435
#>   dat_id transformation normalised  k max_d
#> 1  naive             NA         NA NA    NA
#> 2  naive             NA         NA NA    NA
#> 3  naive             NA         NA NA    NA

# Calculate all measures of metacommunity diversity
metadiv(meta, 0:2)
#>             measure q type_level type_name partition_level partition_name
#> 1         raw alpha 0      types             metacommunity               
#> 2         raw alpha 1      types             metacommunity               
#> 3         raw alpha 2      types             metacommunity               
#> 4  normalised alpha 0      types             metacommunity               
#> 5  normalised alpha 1      types             metacommunity               
#> 6  normalised alpha 2      types             metacommunity               
#> 7          raw beta 0      types             metacommunity               
#> 8          raw beta 1      types             metacommunity               
#> 9          raw beta 2      types             metacommunity               
#> 10  normalised beta 0      types             metacommunity               
#> 11  normalised beta 1      types             metacommunity               
#> 12  normalised beta 2      types             metacommunity               
#> 13          raw rho 0      types             metacommunity               
#> 14          raw rho 1      types             metacommunity               
#> 15          raw rho 2      types             metacommunity               
#> 16   normalised rho 0      types             metacommunity               
#> 17   normalised rho 1      types             metacommunity               
#> 18   normalised rho 2      types             metacommunity               
#> 19            gamma 0      types             metacommunity               
#> 20            gamma 1      types             metacommunity               
#> 21            gamma 2      types             metacommunity               
#>    diversity dat_id transformation normalised  k max_d
#> 1  4.0000000  naive             NA         NA NA    NA
#> 2  3.4641016  naive             NA         NA NA    NA
#> 3  3.0000000  naive             NA         NA NA    NA
#> 4  2.0000000  naive             NA         NA NA    NA
#> 5  1.8329728  naive             NA         NA NA    NA
#> 6  1.7142857  naive             NA         NA NA    NA
#> 7  0.5555556  naive             NA         NA NA    NA
#> 8  0.5455618  naive             NA         NA NA    NA
#> 9  0.5380435  naive             NA         NA NA    NA
#> 10 1.0000000  naive             NA         NA NA    NA
#> 11 1.0310472  naive             NA         NA NA    NA
#> 12 1.0607143  naive             NA         NA NA    NA
#> 13 2.0000000  naive             NA         NA NA    NA
#> 14 1.8329728  naive             NA         NA NA    NA
#> 15 1.7142857  naive             NA         NA NA    NA
#> 16 1.0000000  naive             NA         NA NA    NA
#> 17 0.9698877  naive             NA         NA NA    NA
#> 18 0.9411765  naive             NA         NA NA    NA
#> 19 2.0000000  naive             NA         NA NA    NA
#> 20 1.8898816  naive             NA         NA NA    NA
#> 21 1.8000000  naive             NA         NA NA    NA