Learn R Programming

glossa (version 1.2.1)

variable_importance: Variable Importance in BART Model

Description

This function computes the variable importance scores for a fitted BART (Bayesian Additive Regression Trees) model using a permutation-based approach. It measures the impact of each predictor variable on the model's performance by permuting the values of that variable and evaluating the change in performance (F-score is the performance metric).

Usage

variable_importance(bart_model, y, x, cutoff = 0, n_repeats = 10, seed = NULL)

Value

A data frame where each column corresponds to a predictor variable, and each row contains the variable importance scores across permutations.

Arguments

bart_model

A BART model object.

y

Vector indicating presence (1) or absence (0).

x

Dataframe with same number of rows as the length of the vector `y` with the covariate values.

cutoff

A numeric threshold for converting predicted probabilities into presence-absence.

n_repeats

An integer indicating the number of times to repeat the permutation for each variable.

seed

An optional seed for random number generation.