View source: R/plot_linear_assumption_check.R
plot_linear_assumption_check | R Documentation |
Visual plot to check the assumption that the predicted values are linearly related to the predictors.
plot_linear_assumption_check(
glm_out,
n_groups,
vars = get_numeric_vars(glm_out),
na.rm = TRUE,
x_lab = "Predicted Probabilities",
y_lab = all.vars(glm_out$formula)[1],
x_limits = c(0, 1),
coord_equal = TRUE,
coord_flip = FALSE,
widths = NULL,
legend.position = "bottom",
varplot_nrow = NULL,
varplot_ncol = NULL
)
glm_out |
the results of the logistic regression (i.e. the result from
|
n_groups |
the number of groups to use. By default groups will have a minimum of six observations up to a maximum of 10 groups. |
vars |
character vector with the name of the independent variables to include. If omitted, all numeric variables will be used. |
na.rm |
whether missing values should be removed. |
x_lab |
label for the x-axis. |
y_lab |
label for the y-axis. |
x_limits |
limits for the x-axis. |
coord_equal |
whether the x- and y-axes should be equal. |
coord_flip |
whether the x- and y-axes should be flipped. |
widths |
the relative widths of the two plots. If you only want the first
plot, use |
legend.position |
location of the legend. |
varplot_nrow |
parameter passed to |
varplot_ncol |
parameter passed to |
a ggplot2 expression.
study <- data.frame(
Hours=c(0.50,0.75,1.00,1.25,1.50,1.75,1.75,2.00,2.25,2.50,2.75,3.00,
3.25,3.50,4.00,4.25,4.50,4.75,5.00,5.50),
Pass=c(0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1)
)
lr.out <- glm(Pass ~ Hours, data = study,
family = binomial(link='logit'))
plot_linear_assumption_check(glm_out = lr.out, n_groups = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.