empirical_link | R Documentation |
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.
empirical_link(response, family, na.rm = FALSE)
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 |
Mean response value, on the link scale.
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.