Skip to contents

Provides model-agnostic and tree-based feature attribution, direction of effect, TRIPOD Item 13b / STROBE Item 15a compliant variable importance tables, and cross-site feature importance drift auditing across federated health systems. Requires zero heavy external dependencies.

Usage

consortium_explainability(
  model = NULL,
  X,
  y = NULL,
  feature_names = NULL,
  site_labels = NULL,
  method = "auto",
  n_permutations = 5L,
  top_n = NULL,
  ...
)

Arguments

model

A fitted predictive model (e.g. from randomForest, rpart, glm, xgboost), or NULL.

X

A data frame or numeric matrix of predictors.

y

Optional numeric or factor vector of true outcomes/labels.

feature_names

Optional character vector of feature names if X is a matrix without column names.

site_labels

Optional vector of site identifiers for multi-site importance drift analysis.

method

Attribution method: "auto" (default), "gain", "permutation", or "coefficient".

n_permutations

Number of shuffle iterations for permutation importance (default 5L).

top_n

Optional integer to limit the exported importance table to the top N features.

...

Additional arguments passed to methods.

Value

A consortium_explainability S3 object with elements:

importance

Data frame of ranked features, attributions, standard errors, and directions.

tripod_summary

Publication-ready table adhering to TRIPOD Item 13b / STROBE Item 15a guidelines.

site_drift

Cross-site ranking concordance table if site_labels provided, otherwise NULL.

shap_values

Matrix of sample-level marginal attribution values.

feature_names

Character vector of feature names.

method

Attribution method used.