table_agreement: Table of Agreement

View source: R/ability_agreement.R

table_agreementR Documentation

Table of Agreement

Description

Estimate the impact of AI recommendations on the agreement between human decisions and AI recommendations using a difference-in-means estimator of an indicator 1\{D_i = A_i\}. Generate a table based on the overall agreement and subgroup-specific agreement.

Usage

table_agreement(
  Y,
  D,
  Z,
  A,
  subgroup1,
  subgroup2,
  label.subgroup1 = "Subgroup 1",
  label.subgroup2 = "Subgroup 2"
)

Arguments

Y

An observed outcome (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).

A

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

subgroup1

A pretreatment covariate used for subgroup analysis (vector).

subgroup2

A pretreatment covariate used for subgroup analysis (vector).

label.subgroup1

A label for subgroup1 (character). Default "Subgroup 1".

label.subgroup2

A label for subgroup2 (character). Default "Subgroup 2".

Value

A tibble with the following columns:

  • cov: Subgroup label.

  • X: Subgroup value.

  • agree_diff: Difference in agreement between human decisions and AI recommendations.

  • agree_diff_se: Standard error of the difference in agreement.

  • ci_lb: Lower bound of the 95% confidence interval.

  • ci_ub: Upper bound of the 95% confidence interval.

Examples

table_agreement(
  Y = NCAdata$Y,
  D = ifelse(NCAdata$D == 0, 0, 1),
  Z = NCAdata$Z,
  A = PSAdata$DMF,
  subgroup1 = ifelse(NCAdata$White == 1, "White", "Non-white"),
  subgroup2 = ifelse(NCAdata$Sex == 1, "Male", "Female"),
  label.subgroup1 = "Race",
  label.subgroup2 = "Gender"
)


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