plot_diff_ai_aipw | R Documentation |
Visualize the difference in risk between AI and human decision makers using AIPW estimators. Generate a plot based on the overall and subgroup-specific results.
plot_diff_ai_aipw(
Y,
D,
Z,
V = NULL,
A,
z_compare = 0,
l01 = 1,
nuis_funcs = NULL,
nuis_funcs_ai = NULL,
true.pscore = NULL,
subgroup1,
subgroup2,
label.subgroup1 = "Subgroup 1",
label.subgroup2 = "Subgroup 2",
x.order = NULL,
zero.line = TRUE,
arrows = TRUE,
y.min = -Inf,
p.title = NULL,
p.lb = -1,
p.ub = 1,
y.lab = "PSA versus Human",
p.label = c("PSA worse", "PSA better")
)
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). |
V |
A matrix of pretreatment covariates (numeric matrix). Optional. |
A |
An observed AI recommendation (binary: numeric vector of 0 or 1). |
z_compare |
A compare treatment indicator (numeric). Default 0. |
l01 |
Ratio of the loss between false positives and false negatives. Default 1. |
nuis_funcs |
output from |
nuis_funcs_ai |
output from |
true.pscore |
A vector of true propensity scores (numeric), if available. Optional. |
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". |
x.order |
An order for the x-axis (character vector). Default NULL. |
zero.line |
A logical indicating whether to include a zero line. Default TRUE. |
arrows |
A logical indicating whether to include arrows. Default TRUE. |
y.min |
A lower bound for the y-axis (numeric). Default -Inf. |
p.title |
A title for the plot (character). Default NULL. |
p.lb |
A lower bound for the y-axis (numeric). Default -0.2. |
p.ub |
An upper bound for the y-axis (numeric). Default 0.2. |
y.lab |
A label for the y-axis (character). Default "PSA versus Human". |
p.label |
A vector of two labels for the annotations (character). Default c("PSA harms", "PSA helps"). |
A ggplot object.
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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.