Skip to contents

Runs trait_gradient() with each combination of weights of the site means and of the species means (abundance or occurrence) and puts the values of \(\beta\) and \(\alpha\) of each species side by side, with the correlations among the combinations. Large differences mean that the result depends on the dominant species.

Usage

trait_gradient_weights(data, abundance, ...)

Arguments

data

Data frame with one row per individual or per population (species in a site), such as from sample_individuals(). Rows of one population are averaged.

abundance

Name of the column with abundances (needed here).

...

Further arguments to trait_gradient().

Value

A list with beta and alpha, data frames with one row per species and one column per combination (abundance/abundance, abundance/occurrence, occurrence/abundance, occurrence/occurrence, sites first), and correlation, the correlations of \(\beta\) and of \(\alpha\) between each combination and the first.

Examples

set.seed(1)
tree <- treeshapesim::sim_tree_shape(20)
sim <- simulate_metacommunity(landscape_implicit(15), species_traits(tree),
                              competition_matrix(tree, "none"), n_steps = 100,
                              seed_steps = 1:5)
ind <- sample_individuals(sim, n = 5, intraspecific_sd = 1)
trait_gradient_weights(ind, abundance = "abundance")$correlation
#>                 weights      beta     alpha
#> 1   abundance/abundance 1.0000000 1.0000000
#> 2  abundance/occurrence 0.7747809 0.9483062
#> 3  occurrence/abundance 0.7130104 0.9773422
#> 4 occurrence/occurrence 0.3973584 0.9702739