cricket |>
mutate(
pred_prob = predict(cricket_logit, type = "response"),
bin_pred_prob = cut(pred_prob, breaks = seq(0, 1, .1))
) |>
group_by(bin_pred_prob) |>
summarize(n = n(),
bin_actual_prob = mean(result == "Win")) |>
mutate(mid_point = seq(0.15, 0.95, 0.1)) |>
ggplot(aes(x = mid_point, y = bin_actual_prob)) +
geom_point(aes(size = n)) +
geom_line() +
geom_abline(slope = 1, intercept = 0,
color = "black", linetype = "dashed") +
scale_x_continuous(breaks = seq(0.15, 0.95, 0.1))
# expand_limits(x = c(0, 1), y = c(0, 1))