MyNixOS website logo
Description

Experimental Evaluation of Algorithm-Assisted Human Decision-Making.

Provides statistical methods for analyzing experimental evaluation of the causal impacts of algorithmic recommendations on human decisions developed by Imai, Jiang, Greiner, Halen, and Shin (2023) <doi:10.1093/jrsssa/qnad010> and Ben-Michael, Greiner, Huang, Imai, Jiang, and Shin (2024) <doi:10.48550/arXiv.2403.12108>. The data used for this paper, and made available here, are interim, based on only half of the observations in the study and (for those observations) only half of the study follow-up period. We use them only to illustrate methods, not to draw substantive conclusions.

aihuman

R-CMD-check

Overview

aihuman provides statistical methods for analyzing experimental evaluation of the causal impacts of algorithmic recommendations on human decisions developed by Imai, Jiang, Greiner, Halen, and Shin (2023).

The data used for this paper, and made available here, are interim, based on only half of the observations in the study and (for those observations) only half of the study follow-up period. We use them only to illustrate methods, not to draw substantive conclusions.

Installation

You can install the development version of aihuman from GitHub with:

# install.packages("devtools")
devtools::install_github("sooahnshin/aihuman", dependencies = TRUE, build_vignettes = TRUE)

If you have trouble with compilation on macOS, you may want to check this link.

Usage 1: Evaluation Based on Principal Stratification

The package provides main functions for the methods proposed by Imai, Jiang, Greiner, Halen, and Shin (2023) based on principal stratification.

CategoryFunctionTypeMain InputOutputPaperNotes
descriptivePlotStackedBar()vis.e.g., data(psa_synth)ggplotFig 1dist. of $D_i$
descriptiveCalDIMsubgroup()est.e.g., data(synth)dataframeSec 2.4diff-in-means
descriptivePlotDIMdecisions()vis.output of CalDIMsubgroup()ggplotFig 2 (left)
descriptivePlotDIMoutcomes()vis.output of CalDIMsubgroup() for each outcomeggplotFig 2 (right)
mainAiEvalmcmc()est.(c/h)e.g., data(synth)mcmcSec S5
mainCalAPCE()est.(c/h)output of PSAmcmc()listSec 3.4
mainAPCEsummary()est.output of CalAPCE()dataframeSec 3.4APCE
mainPlotAPCE()vis.output of APCEsummary()ggplotFig 4
strataCalPS()est.$P.R.mcmc of CalAPCE()dataframeEq 6$e_r$
strataPlotPS()vis.output of CalPS()ggplotFig 3
fairnessCalFairness()est.output of CalAPCE()dataframeSec 3.6$\Delta_r(z)$
fairnessPlotFairness()est.output of CalFairness()ggplotFig 5
optimalCalOptimalDecision()est.output of AiEvalmcmc()dataframeSec 3.7$\delta^\ast(\mathbf{x})$
optimalPlotOptimalDecision()vis.output of CalOptimalDecision()ggplotFig 6
comparisonPlotUtilityDiff()vis.output of CalOptimalDecision()ggplotFig 7$g_d(\mathbf{x})$
comparisonPlotUtilityDiffCI()vis.output of CalOptimalDecision()ggplotFig S17
crtSpilloverCRT()est.court event hearing date, $D_i$, $Z_i$daraframeSec S3.1
crtPlotSpilloverCRT()vis.output of SpilloverCRT()ggplotFig S8
crt powerSpilloverCRTpower()est.court event hearing date, $D_i$, $Z_i$dataframeSec S3.2
crt powerPlotSpilloverCRTpower()vis.output of SpilloverCRTpower()ggplotFig S9
frequentistCalAPCEipw()est.e.g., data(synth)dataframeSec S7
frequentistBootstrapAPCEipw()est.e.g., data(synth)dataframe
frequentistAPCEsummaryipw()est.outputs of CalAPCEipw() and BootstrapAPCEipw()dataframe
frequentist (RE)CalAPCEipwRE()est.e.g., data(synth)dataframe
frequentist (RE)BootstrapAPCEipwRE()est.e.g., data(synth)dataframe

vis. = visualization; est. = estimation; c/h = computation-heavy. You may use CalAPCEparallel() instead of CalAPCE() throughout the analysis.

For more details, see the aihuman package vignette, vignette("aihuman", package = "aihuman").

Example

library(aihuman)
## Using synthetic data with small run
data(synth)
sample_mcmc <- AiEvalmcmc(data = synth, n.mcmc = 10)
#> 10/10 done.
subgroup_synth <- list(1:nrow(synth),
                       which(synth$Sex == 0),
                       which(synth$Sex == 1),
                       which(synth$Sex == 1 & synth$White == 0),
                       which(synth$Sex == 1 & synth$White == 1))
sample_apce <- CalAPCE(data = synth, 
                       mcmc.re = sample_mcmc, 
                       subgroup = subgroup_synth)
# You can also use the parallelized version: check CalAPCEparallel()
sample_apce_summary <- APCEsummary(sample_apce[["APCE.mcmc"]])
PlotAPCE(sample_apce_summary, 
         y.max = 0.25, 
         decision.labels = c("signature", "small cash", "medium cash", "large cash"), 
         shape.values = c(16, 17, 15, 18), 
         col.values = c("blue", "black", "red", "brown", "purple"), 
         label = FALSE)

Usage 2: Evaluation With Minimal Assumptions

The package provides main functions for the methods proposed by Ben-Michael, Greiner, Huang, Imai, Jiang, and Shin (2024) based on a minimal set of assumptions.

CategoryFunctionTypeOutputFigure #
Human+AI v. Humancompute_stats_aipw()est.dataframe
Human+AI v. Humanplot_diff_human_aipw()vis.ggplotFig 1
AI v. Humancompute_bounds_aipw()est.dataframe
AI v. Humanplot_diff_ai_aipw()vis.ggplotFig 2, 5, S4
Preferenceplot_preference()vis.ggplotFig 3, S5
Agreementtable_agreement()estggplot
Agreementplot_agreement()vis.ggplotFig S1
Overridesplot_diff_subgroup()vis.ggplotFig S2, S3
Policy learningSee the vignettevis.ggplotFig 4

For more details, see the ablity vignette, vignette("ability", package = "aihuman").

Example

library(ggplot2)
## set default ggplot theme
theme_set(theme_bw(base_size = 15) + theme(plot.title = element_text(hjust = 0.5)))

## Human+AI v. Human
plot_diff_human_aipw(
  Y = NCAdata$Y,
  D = ifelse(NCAdata$D == 0, 0, 1),
  Z = NCAdata$Z,
  nuis_funcs = nuis_func,
  true.pscore = rep(0.5, nrow(NCAdata)),
  l01 = 1,
  subgroup1 = ifelse(NCAdata$White == 1, "White", "Non-white"),
  subgroup2 = ifelse(NCAdata$Sex == 1, "Male", "Female"),
  label.subgroup1 = "Race",
  label.subgroup2 = "Gender",
  x.order = c("Overall", "Non-white", "White", "Female", "Male"),
  p.title = NULL, p.lb = -0.3, p.ub = 0.3
)

## AI v. Human
plot_diff_ai_aipw(
  Y = NCAdata$Y,
  D = ifelse(NCAdata$D == 0, 0, 1),
  Z = NCAdata$Z,
  A = PSAdata$DMF,
  z_compare = 0,
  nuis_funcs = nuis_func,
  nuis_funcs_ai = nuis_func_ai,
  true.pscore = rep(0.5, nrow(NCAdata)),
  l01 = 1,
  subgroup1 = ifelse(NCAdata$White == 1, "White", "Non-white"),
  subgroup2 = ifelse(NCAdata$Sex == 1, "Male", "Female"),
  label.subgroup1 = "Race",
  label.subgroup2 = "Gender",
  x.order = c("Overall", "Non-white", "White", "Female", "Male"),
  zero.line = TRUE, arrows = TRUE, y.min = -Inf,
  p.title = NULL, p.lb = -0.3, p.ub = 0.3
)
Metadata

Version

1.0.0

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows