Calculates the average value of the response variable, and places this on the link scale. Plotting these against a predictor (by dividing the dataset into bins) can help assess the choice of link function.
Arguments
- response
Vector of response variable values.
- family
Family object representing the response distribution and link function. Only the link function will be used.
- na.rm
Should
NA
values of the response be stripped? Passed tomean()
when calculating the mean of the response.
Examples
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()