Skip to content

Instantly share code, notes, and snippets.

@Dpananos
Created March 9, 2021 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Dpananos/2443e0759608e04be9950f3389ec685c to your computer and use it in GitHub Desktop.
Save Dpananos/2443e0759608e04be9950f3389ec685c to your computer and use it in GitHub Desktop.
library(tidyverse)
set.seed(7)
N = 1000
x = rnorm(N)
p = plogis(0.2*x - 0.8)
y = rbinom(N, 1, p)
tibble(x, y) %>%
mutate(z = cut_number(x, 5)) %>%
ggplot(aes(z, y))+
stat_summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment