View source: R/ability_agreement.R
plot_agreement | R Documentation |
Visualize the agreement between human decisions and AI recommendations using a difference-in-means estimator of an indicator 1\{D_i = A_i\}
.
Generate a plot based on the overall agreement and subgroup-specific agreement.
plot_agreement(
Y,
D,
Z,
A,
subgroup1,
subgroup2,
label.subgroup1 = "Subgroup 1",
label.subgroup2 = "Subgroup 2",
x.order = NULL,
p.title = NULL,
p.lb = -0.3,
p.ub = 0.3,
y.lab = "Impact of PSA"
)
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". |
x.order |
An order for the x-axis (character vector). Default NULL. |
p.title |
A title for the plot (character). Default NULL. |
p.lb |
A lower bound for the y-axis (numeric). Default -0.3. |
p.ub |
An upper bound for the y-axis (numeric). Default 0.3. |
y.lab |
A label for the y-axis (character). Default "Impact of PSA". |
A ggplot object.
plot_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",
x.order = c("Overall", "Non-white", "White", "Female", "Male")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.