suppressMessages(library(dplyr))
suppressMessages(library(ggplot2))
mtcars |>
bin_by_interval(disp, breaks = 5) |>
summarize(
mean_disp = mean(disp),
link = empirical_link(am, binomial())
) |>
ggplot(aes(x = mean_disp, y = link)) +
geom_point()
Run the code above in your browser using DataLab