View source: R/residuals_diagnostics.R
residuals_diagnostics | R Documentation |
Applies a Shapiro-Wilks test to a numeric vector, and plots the qq plot and the histogram.
residuals_diagnostics(residuals, predictions)
residuals |
Numeric vector, model residuals. |
predictions |
Numeric vector, model predictions. |
The function shapiro.test()
has a hard limit of 5000 cases. If the model residuals have more than 5000 cases, then sample(x = residuals, size = 5000)
is applied to the model residuals before the test.
A list with four slots:
/item w
W statistic returned by shapiro.test()
.
/item p.value
p-value of the Shapiro test.
/item interpretation
Character vector, one of "x is normal", "x is not normal".
/item plot
A patchwork plot with the qq plot and the histogram of x.
ggplot
,aes
,geom_qq_line
,ggtheme
,labs
,geom_freqpoly
,geom_abline
plot_annotation
if(interactive()){ residuals_diagnostics( residuals = runif(100), predictions = runif(100) ) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.