glm_assump | R Documentation |
This function is to examine linearity and outliers of a logistic regression.
glm_assump( data, x, y, alpha, se = c(TRUE, FALSE), size, line_size, color, loess_color, line_color )
data |
The data frame that includes the variables you are interested in examining in a logistic regression. |
x |
Predictors to be included in your linear regression. You can either include one variable in quotations (e.g., "hp" from the mtcars dataset) or you can create an object of predictors (e.g., predictors <- c("disp", "cyl", "wt")). |
y |
Your outcome of interest. |
alpha |
Value to determine how transparent you'd like your points in this function's plots. |
se |
A logical vector to decide if you'd like to include the standard error for your plots. |
size |
Value to determine the size of the points in this function's plots. You can also determine if you'd like to assign these values to a categorical variable in your dataset. |
line_size |
Value to decide if you'd like your lines to be thinner or thicker in your plots |
color |
Value to determine what color you'd like your points to be in the scatterplot (e.g., "blue", "#6a1f25") |
loess_color |
value to determine what color you'd like your loess line to be in the scatterplot (e.g., "blue", "#6a1f25") |
line_color |
value to determine what color you'd like your linear relationship to be in the scatterplot (e.g., "blue", "#6a1f25") |
Returns two ggplot2 visuals. One for the assumption of linearity predicting logit of the outcome and the second to check for outliers in the residuals.
glm_assump(data = mtcars, x = "hp", y = vs, alpha = .5, se = FALSE, size = 2, line_size = 1.25, color = "dodgerblue", loess_color = "red", line_color = "blue") predictors <- c("hp", "carb", "gear") glm_assump(data = mtcars, x = predictors, y = vs, alpha = .5, se = FALSE, size = 2, line_size = 1.25, color = "dodgerblue", loess_color = "red", line_color = "blue")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.