ggdiagnose | R Documentation |
Graphically diagnose model residuals (ggplot2 version).
ggdiagnose(model, fit_type = 'response', residual_type = 'response', bins = 30, se = TRUE, freqpct = FALSE, alpha = 1)
model |
An lm or glm object. |
fit_type |
String. Default is "response". Type of fitted values to use based on options in predict(). |
residual_type |
String. Default is "response". Type of residuals values to use based on options in resid(). |
bins |
Number of bins to specify for histograms. |
se |
Boolean. For overlaying shaded standard errors. |
freqpct |
Boolean. |
alpha |
Integer, [0, 1]. Points are more transparent the closer they are to 0. Only applies to scatter plots. |
2 scatter plots and 2 histograms of residuals and "residuals margin," which is the residuals as a percentage of the actual dependent variable values.
https://github.com/robertschnitman/diagnoser
# OLS case model <- lm(data = mtcars, formula = mpg ~ wt + gear) ggdiagnose(model, bins = NROW(mtcars), se = FALSE, freqpct = TRUE) # NLS case model.nls <- nls(Ozone ~ theta0 + Temp^theta1, airquality) ggdiagnose(model.nls)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.