Skip to contents

Applies phylogenetic linear models for each restriction in a list of data frames, testing ability of restrictions to explain specified response variables. Extracts phylogenetic linear model statistics and summaries.

Usage

eval_restriction_performance(
  df_list,
  response_vars,
  phylo,
  use_phylolm = TRUE,
  phylolm_model = "BM"
)

Arguments

df_list

List of data frames each containing species data and restrictions (starting after "_flag" columns).

response_vars

Character vector of response variable names to test in the linear models. Must be included in the df_list.

phylo

A phylogenetic tree of class phylo, required if use_phylolm = TRUE.

use_phylolm

Logical; if TRUE, fits phylogenetic linear models with phylolm. If FALSE, fits standard linear models with lm.

phylolm_model

Character string specifying the model type to pass to phylolm, e.g. "BM" (Brownian motion).

Value

A data frame combining results across all models and response variables. Returned columns differ depending on whether use_phylolm is TRUE or FALSE:

If use_phylolm = TRUE:

  • method: Identifier of the combo/data frame.

  • model: Restriction name.

  • term: Predictor variable (restriction term).

  • response_variable: Response variable tested.

  • estimate: Model coefficient estimate.

  • std_error: Standard error of the estimate.

  • p_value: p-value of the coefficient.

  • AIC: Akaike Information Criterion value of the model.

  • multiple_R2: Model R-squared.

  • adjusted_R2: Adjusted R-squared.

If use_phylolm = FALSE:

  • method: Identifier of the combo/data frame.

  • model: Restriction name.

  • response_variable: Response variable tested.

  • AIC: Akaike Information Criterion value of the model.

  • df: Degrees of freedom used in the ANOVA.

  • F_statistic: F statistic from the ANOVA.

  • p_value: p-value from the ANOVA F-test.

  • multiple_R2: Multiple R-squared of the model.

  • adjusted_R2: Adjusted R-squared of the model.

Note

To run highly multidimensional models such as GDR, the number of species must outnumber the possible rarity types (i.e., at least 63 species for GDR) to ensure the linear models work correctly.