kevinrue/OBDS_slides

illustrate paired statistics

Opened this issue · 0 comments

x <- runif(n = n_sample, min = 10, max = 20)
y <- x + 2 + rnorm(n = n_sample, mean = 0, sd = 1)

df <- data.frame(x, y)

max_diff <- max(abs(y - x))

ggplot(df, aes(y-x)) +
    geom_histogram(color = "black", fill = "grey") +
    coord_cartesian(xlim = c(-1, 1) * max_diff) +
    geom_vline(xintercept = 0, color = "red") +
    labs(
        x = "Difference (y - x)",
        y = "Observations"
    ) +
    theme_minimal()