Learn R Programming

PEAXAI (version 0.1.0)

PEAXAI_ranking: Generate Efficiency Rankings Based on Probabilistic Classification

Description

Produces efficiency rankings of decision-making units (DMUs) according to the probabilities estimated by a fitted classification model. Two ranking modes are supported:

  • "predicted": ranks DMUs solely by their predicted probability of being efficient.

  • "attainable": ranks DMUs hierarchically according to: (1) the attainable (target) efficiency probability, (2) the size of the improvement parameter \(\beta\) (smaller is better), and (3) the predicted efficiency probability (higher is better).

This allows to integrate both predictive and counterfactual (attainable) information into the efficiency ranking.

Usage

PEAXAI_ranking(
  data,
  x,
  y,
  final_model,
  efficiency_thresholds,
  targets = NULL,
  rank_basis
)

Value

  • If rank_basis = "predicted": a data.frame sorted by predicted efficiency probability.

  • If rank_basis = "attainable": a named list of data.frames, one per efficiency threshold, each sorted according to the hierarchical ranking scheme described above.

Arguments

data

A data.frame or matrix containing the input and output variables.

x

Integer vector specifying the column indices of input variables in data.

y

Integer vector specifying the column indices of output variables in data.

final_model

A fitted classification model used to estimate efficiency probabilities. Supported types are:

  • "train": an object fitted with caret.

  • "glm": a binomial logistic regression model.

efficiency_thresholds

Numeric vector defining one or more efficiency probability thresholds to determine the attainable frontier or peer set.

targets

A named list containing, for each efficiency threshold, the corresponding attainable targets and estimated \(\beta\) values (e.g., obtained from counterfactual analysis). Each element should be a list with a component named "beta".

rank_basis

Character string specifying the ranking criterion. Options are:

  • "predicted": order units by predicted efficiency probability.

  • "attainable": order by attainable probability, then by \(\beta\), and finally by predicted probability (see Details).

Details

The attainable-based ranking combines predictive efficiency with the modeled potential for improvement (\(\beta\)) and the probability of reaching a target frontier level. This approach yields a more nuanced and interpretable prioritization of DMUs, reflecting both their current and achievable performance under the estimated model.

When rank_basis = "attainable", ties in attainable probability are broken first by the magnitude of \(\beta\) (ascending), and then by the predicted probability (descending).

Examples

Run this code
# \donttest{
  data("firms", package = "PEAXAI")

  data <- subset(
    firms,
    autonomous_community == "Comunidad Valenciana"
  )

  x <- 1:4
  y <- 5
  RTS <- "vrs"
  imbalance_rate <- NULL

  trControl <- list(
    method = "cv",
    number = 3
  )

  # glm method
  methods <- list(
    "glm" = list(
      weights = "dinamic"
     )
  )

  metric_priority <- c("Balanced_Accuracy", "ROC_AUC")

  models <- PEAXAI_fitting(
    data = data, x = x, y = y, RTS = RTS,
    imbalance_rate = imbalance_rate,
    methods = methods,
    trControl = trControl,
    metric_priority = metric_priority,
    verbose = FALSE,
    seed = 1
  )

  final_model <- models[["best_model_fit"]][["glm"]]

  relative_importance <- PEAXAI_global_importance(
    data = data, x = x, y = y,
    final_model = final_model,
    background = "real", target = "real",
    importance_method = list(name = "PI", n.repetitions = 5)
  )

  efficiency_thresholds <- seq(0.75, 0.95, 0.1)

  directional_vector <- list(relative_importance = relative_importance,
  scope = "global", baseline  = "mean")

  targets <- PEAXAI_targets(data = data, x = x, y = y, final_model = final_model,
  efficiency_thresholds = efficiency_thresholds, directional_vector = directional_vector,
  n_expand = 0.5, n_grid = 50, max_y = 2, min_x = 1)

  ranking <- PEAXAI_ranking(data = data, x = x, y = y,
  final_model = final_model, rank_basis = "predicted")
# }

Run the code above in your browser using DataLab