compute_bounds_aipw: Compute Risk (AI v. Human)

View source: R/ability_compute_bounds.R

compute_bounds_aipwR Documentation

Compute Risk (AI v. Human)

Description

Compute the difference in risk between AI and human decision makers using AIPW estimators.

Usage

compute_bounds_aipw(
  Y,
  A,
  D,
  Z,
  X = NULL,
  nuis_funcs,
  nuis_funcs_ai,
  true.pscore = NULL,
  l01 = 1
)

Arguments

Y

An observed outcome (binary: numeric vector of 0 or 1).

A

An observed AI recommendation (binary: numeric vector of 0 or 1).

D

An observed decision (binary: numeric vector of 0 or 1).

Z

A treatment indicator (binary: numeric vector of 0 or 1).

X

Pretreatment covariate used for subgroup analysis (vector). Must be the same length as Y, D, Z, and A if provided. Default is NULL.

nuis_funcs

output from compute_nuisance_functions

nuis_funcs_ai

output from compute_nuisance_functions_ai

true.pscore

A vector of true propensity scores (numeric), if available. Optional.

l01

Ratio of the loss between false positives and false negatives

Value

A tibble the following columns:

  • Z_focal: The focal treatment indicator. '1' indicates the treatment group.

  • Z_compare: The comparison treatment indicator. '0' indicates the control group.

  • X: Pretreatment covariate (if provided).

  • fn_diff_lb: The lower bound of difference in false negatives

  • fn_diff_ub: The upper bound of difference in false negatives

  • fp_diff_lb: The lower bound of difference in false positives

  • fp_diff_ub: The upper bound of difference in false positives

  • loss_diff_lb: The lower bound of difference in loss

  • loss_diff_ub: The upper bound of difference in loss

  • fn_diff_lb_se: The standard error of the difference in false negatives

  • fn_diff_ub_se: The standard error of the difference in false negatives

  • fp_diff_lb_se: The standard error of the difference in false positives

  • fp_diff_ub_se: The standard error of the difference in false positives

  • loss_diff_lb_se: The standard error of the difference in loss

  • loss_diff_ub_se: The standard error of the difference in loss

Examples

compute_bounds_aipw(
  Y = NCAdata$Y,
  A = PSAdata$DMF,
  D = ifelse(NCAdata$D == 0, 0, 1),
  Z = NCAdata$Z,
  nuis_funcs = nuis_func,
  nuis_funcs_ai = nuis_func_ai,
  true.pscore = rep(0.5, nrow(NCAdata)),
  X = NULL,
  l01 = 1
)

aihuman documentation built on April 12, 2025, 1:47 a.m.