Skip to content

Instantly share code, notes, and snippets.

@swiftsam
Last active December 1, 2017 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swiftsam/97f1baa03e5037883a41dc3b2aeed86f to your computer and use it in GitHub Desktop.
Save swiftsam/97f1baa03e5037883a41dc3b2aeed86f to your computer and use it in GitHub Desktop.
ggplot code to reproduce figure 4 from https://doi.org/10.1287/mnsc.2016.2525
library(ggplot2)
library(data.table)
library(scales)
ct.binned <- overp.indiv.ct[, list(confidence = mean(MeanMaxFcast),
hit_rate = mean(HitRate),
ci_hit_rate = 1.96*sd(HitRate)/sqrt(.N),
count = .N),
by=c("bin,ct")]
ct.binned[, ct2 := ordered(ct, levels = c("1a","1b","4a","4b"), labels = c("Auto No Train", "Auto Trained", "Team No Train", "Team Trained"))]
cac.ct <-
ggplot(ct.binned, aes(confidence, hit_rate, shape = ct2, color = ct2)) +
geom_segment(aes(x = .2, y = .2, xend = 1, yend = 1), linetype=2, color="grey50") +
geom_line(size=0.9, aes(group = ct)) +
geom_point(size=3) +
scale_shape_manual(values = c(19, 17, 4, 15)) +
scale_x_continuous(labels=percent, limits=c(.2,1)) +
scale_y_continuous(labels=percent, limits=c(.2,1)) +
labs(x="Confidence",
y="Accuracy",
color="Experimental \n Condition",
shape="Experimental \n Condition") +
theme_bw(base_size=16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment