Skip to contents

This function evaluates the equal opportunity compliance of a predictive model by comparing the False Negative Rates (FNR) across different groups defined by a sensitive attribute. It is used to determine if a model exhibits bias towards any group for binary outcomes.

Usage

eval_eq_opp(
  data,
  outcome,
  group,
  probs,
  cutoff = 0.5,
  bootstraps = 2500,
  alpha = 0.05,
  digits = 2,
  message = TRUE
)

Arguments

data

A dataframe containing the actual outcomes, predicted probabilities, and sensitive attributes necessary for evaluating model fairness.

outcome

The name of the outcome variable in the data; it must be binary.

group

The name of the sensitive attribute variable used to define groups for comparison in the fairness evaluation.

probs

The name of the variable containing predicted probabilities or scores.

cutoff

The threshold for converting predicted probabilities into binary predictions; defaults to 0.5.

bootstraps

The number of bootstrap samples used for estimating the confidence interval; defaults to 2500.

alpha

The 1 - significance level for the confidence interval; defaults to 0.05.

digits

The number of decimal places to which numerical results are rounded; defaults to 2.

message

Logical; whether to print summary results to the console; defaults to TRUE.

Value

Returns a dataframe with the following columns:

  • Metric: Describes the metric being reported (FNR for each group, difference).

  • Group1: False Negative Rate for the first group.

  • Group2: False Negative Rate for the second group.

  • Difference: The difference in False Negative Rates between the two groups.

  • CI: The 95% confidence interval for the FNR difference.

Examples

# Example usage:
eval_eq_opp(
  data = your_data, outcome = "actual_outcome",
  group = "sensitive_attribute", probs = "predicted_probs"
)
#> Error in eval(expr, envir, enclos): object 'your_data' not found