predict_invasible: Predict invasion risk and evaluate model performance

View source: R/predict_invasible.R

predict_invasibleR Documentation

Predict invasion risk and evaluate model performance

Description

  1. Fits a phylogenetic generalized linear mixed model (PGLMM) from the output of invasion_signal()

  2. Calculates the probability of being invasive for all species, based on the phylogeny (and optionally species traits) given to the original prepare_invasible() function

  3. Computes predictive performance metrics such as ROC AUC

  4. Plots the predicted values for observed invasive species (1) vs non-invading species (0) (optional)

Usage

predict_invasible(signal, vcv_alpha = NULL, plot = FALSE, fam = "gaussian")

Arguments

signal

Output of invasion_signal()

vcv_alpha

Numeric, optional: set a value of alpha for OU model which is different to the value inherited from the invasion_signal() output

plot

Logical. If TRUE, returns diagnostic plot of observed vs predicted

fam

Character, Distribution family of the model (if other than "binomial")

Value

An object of class pred_output, a list containing:

model

Fitted PGLMM model object.

predictions

Data frame with observed and predicted values for all species.

ranked_predictions

Candidate invasives ordered by decreasing probability.

roc

ROC object

auc

Numeric AUC (area under the curve) value.

plot

ggplot object (if requested; run pred_output$plot to show).

Examples

species_list <- fish_beginning_with_E
prep <- prepare_invasible(species_list,rho=1, predictors=c("Fake_continuous_trait"))
signal <- invasion_signal(prep)
pred <- predict_invasible(signal,plot=TRUE)
pred$ranked_predictions
pred$auc
pred$plot


invasible documentation built on Oct. 8, 2026, 5:07 p.m.