```
library(tidyverse)
# study parameters
true_effect <- 1
se <- 1/3.84
x <- rnorm(500000, mean = true_effect, sd = se)
df <- data.frame(x)
ggplot() +
geom_histogram(data = df,
aes(x = x, y = after_stat(density)), binwidth = se, boundary = true_effect, fill = "grey", alpha = bg_alpha) +
geom_vline(data = se_lines, aes(xintercept = se,
color = -dnorm(se_)), linetype = "dashed", alpha = bg_alpha) +
geom_label(data = se_lines, aes(x = se, y = Inf, label = label, group = NULL), vjust = 1.5, color = alpha('black', bg_alpha)) +
geom_label(data = se_lines, aes(x = ch_loc, y = 0, label = chance, group = NULL), vjust = -1, color = alpha('black', bg_alpha)) +
geom_vline(xintercept = 0) +
geom_function(fun = dnorm, args = list(mean = true_effect, sd = se), size = 1) +
theme_bw() +
labs(x = "Estimate of Effect",
y = "Density") +
geom_area(data = tibble(x = seq(1.64*se, 3*se + true_effect, by = 0.1)), aes(x = x),
stat = "function", fun = dnorm, args = list(mean = true_effect, sd = se),
fill = "#d95f02", alpha = 0.1, xlim = c(1.64*se, 3**se + true_effect)) +
#annotate("label", x = 1.3, y = .1, label = "fraction rejected", color = "#d95f02", size = 6) +
annotate("segment", x = true_effect, xend = true_effect, y = 0, yend = dnorm(true_effect, mean = true_effect, sd = se), color = "#d95f02", size = 1) +
annotate("label", x = true_effect, y = dnorm(true_effect, mean = true_effect, sd = se)/2, label = "true effect", color = "#d95f02") +
annotate("segment", x = 1.64*se, xend = 1.64*se, y = 0, yend = .75, color = "#1b9e77", size = 1) +
annotate("label", x = 1.64*se, y = .75, label = "1.64 SEs above zero", color = "#1b9e77") +
annotate("segment", x = 0, xend = 1.64*se,
y = .125,
yend = .125,
color = "#7570b3", size = 1,
lineend = "round", linejoin = "round", arrow = arrow(length = unit(0.1, "inches"), ends = "both")) +
annotate("label", x = 0.5*1.64*se, y = .125, label = "1.64 SEs", color = "#7570b3", size = 4) +
annotate("segment", x = true_effect, xend = 1.64*se,
y = .125,
yend = .125,
color = "black", size = 1,
lineend = "round", linejoin = "round", arrow = arrow(length = unit(0.1, "inches"), ends = "both")) +
annotate("label", x = 1.64*se + (true_effect - 1.64*se)/2, y = .125
, label = "ideally 2 SEs", color = "black", size = 4) +
annotate("segment", x = true_effect, xend = 0,
y = 1, yend = 1,
color = "black", size = 1,
lineend = "round", linejoin = "round", arrow = arrow(length = unit(0.1, "inches"), ends = "both")) +
annotate("label", x = true_effect/2, y = 1, label = "ideally 3.64 SEs", color = "black", size = 4) +
theme(legend.position = "none") +
xlim(-0.1, 2.0)
```