Skip to contents

Runs the full pipeline of generating gdrare combos, evaluating restriction performance through ANOVA, and summarizing the best performing methods using AIC.

Usage

restriction_performance_pipeline(
  species_df,
  abundance_df,
  trait_cols = c("SLA", "height", "seed_mass"),
  geo_methods = c("taxonomic", "range"),
  fun_methods = c("min_distance", "mean_distance"),
  abundances = c(TRUE, FALSE),
  threshold_sets = list(list(GR = 0.15, GL = 0.15, FR = 0.9, FL = 0.9, PR = 0.75, PL =
    0.75), list(GR = 0.15, GL = 0.15, FR = 0.75, FL = 0.75, PR = 0.75, PL = 0.75),
    list(GR = 0.15, GL = 0.15, FR = 0.9, FL = 0.9, PR = 0.9, PL = 0.9), list(GR = 0.15,
    GL = 0.15, FR = 0.9, FL = 0.9, PR = 0.75, PL = 0.75)),
  direction_sets = list(list(GR = "low", GL = "low", FR = "high", FL = "high", PR =
    "high", PL = "high"), list(GR = "low", GL = "low", FR = "high", FL = "high", PR =
    "high", PL = "high"), list(GR = "low", GL = "low", FR = "high", FL = "high", PR =
    "high", PL = "high"), list(GR = "low", GL = "low", FR = "high", FL = "high", PR =
    "high", PL = "high")),
  species_col = "species",
  response_vars = c("range_diff", "flowering_duration"),
  use_internal_phylo = TRUE,
  internal_phylo_name = "ALLMB",
  phylo = NULL,
  k_means = FALSE,
  additional_dimensions = NULL,
  model = NULL,
  verbose = TRUE
)

Arguments

species_df

Data frame of species trait and metadata.

abundance_df

Data frame of species-by-site abundance data. Must contain columns 'species', 'site', 'presence_absence', and 'abundance'.

trait_cols

Character vector of trait column names to use.

geo_methods

Method to calculate geographic rarity. Options: "taxonomic" (based on site occupancy), or "range" (based on convex hull/range size). Default is "taxonomic".

fun_methods

Method for functional rarity. Options: "min_distance", "mean_distance", or "none" to exclude functional rarity. Default is "min_distance".

abundances

Logical; if TRUE, include abundance weighting when calculating community rarity metrics. Default is TRUE.

threshold_sets

List of threshold sets for rarity classification. Must be a list of list.

direction_sets

List of direction sets ("high"/"low") corresponding to threshold sets. Must be a list of list.

species_col

Name of species column in species_df.

response_vars

Character vector of response variables for ANOVA testing.

use_internal_phylo

Logical to use internal seed plant phylogeny.

internal_phylo_name

Name of the internal seed plant phylogeny to use if applicable. Default: "ALLMB". Options: "ALLMB", "ALLOTB", "GBMB", "GBOTB".

phylo

An optional phylogenetic tree of class phylo. If provided and use_internal_phylo is FALSE, this tree will be used for phylogenetic rarity calculations.

k_means

Logical, whether to use k-means clustering.

additional_dimensions

Optional list of additional custom rarity axes to include in the analysis.

model

Optional specified restriction to pass through.

verbose

Logical to print progress. Default is TRUE.

Value

A list containing:

  • combos: Output list from run_all_gdrare_combos().

  • anova_results: Data frame of combined ANOVA results.

  • best_models: Data frame of best method selected per restriction and response variable.