Fit a linear model and compute SHAP values with response centering

fit_predict_shap(
  X,
  y,
  newx,
  model_type = "lm",
  center_response = TRUE,
  account_correlations = FALSE,
  n_samples = 100,
  lambda = 0.01,
  tau = 0.5,
  alpha = 1
)

Arguments

X

Training feature matrix or data frame

y

Training response vector

newx

New feature matrix or data frame for prediction/explanation

model_type

Type of model: "lm", "rlm", "rq", "glmnet"

center_response

Whether to center the response variable

account_correlations

Whether to use correlation-aware SHAP

n_samples

Number of samples for correlation-aware computation

lambda

Regularization parameter for glmnet

tau

Quantile for quantile regression

alpha

Elastic net mixing parameter for glmnet

Value

List with model, predictions, SHAP values, and validation results