qqrplot {topmodels} | R Documentation |
Visualize goodness of fit of regression models by Q-Q plots using quantile residuals.
qqrplot(object, newdata = NULL, trafo = qnorm, type = c("random", "quantile"), nsim = 1L, prob = 0.5, range = FALSE, diag = TRUE, col = "black", fill = "lightgray", xlim = NULL, ylim = NULL, main = "Q-Q residuals plot", xlab = "Theoretical quantiles", ylab = "Quantile residuals", ...)
object |
an object (for which a |
newdata |
optionally, a data frame in which to look for variables with which to predict. If omitted, the original observations are used. |
trafo |
function for tranforming residuals from probability scale to a different distribution scale (default: Gaussian). |
type, nsim, prob |
arguments passed to |
range |
logical or quantile specification. Should the range of
quantiles of the randomized quantile residuals be visualized? If |
diag |
logical or color specification. Should a diagonal reference line be drawn? |
col, fill, xlim, ylim, main, xlab, ylab, ... |
graphical plotting parameters
passed to |
Q-Q residual draw quantile residuals (by default: transformed to standard
normal scale) against theoretical quantiles from the same distribution.
Alternatively, transformations to other distributions can also be used, specifically
using no transformation at all, i.e., remaining on the uniform scale
(via trafo = NULL
or equivalently qunif
or identity
).
Additional options are offered for models with discrete responses where randomization of quantiles is needed.
An list is returned invisibly with:
normal |
the theoretical normal quantiles, |
residuals |
the empirical quantile residuals. |
Dunn KP, Smyth GK (1996). “Randomized Quantile Residuals.” Journal of Computational and Graphical Statistics, 5, 1–10.
## linear regression models (homoscedastic Gaussian response) m <- lm(dist ~ speed, data = cars) qqrplot(m) qqrplot(m, trafo = NULL)