qqrplot {topmodels}R Documentation

Q-Q Plots for Quantile Residuals

Description

Visualize goodness of fit of regression models by Q-Q plots using quantile residuals.

Usage

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", ...)

Arguments

object

an object (for which a qresiduals method exists).

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 qresiduals.

range

logical or quantile specification. Should the range of quantiles of the randomized quantile residuals be visualized? If TRUE, then range = c(0.01, 0.99) is used.

diag

logical or color specification. Should a diagonal reference line be drawn?

col, fill, xlim, ylim, main, xlab, ylab, ...

graphical plotting parameters passed to plot or points, respectively.

Details

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.

Value

An list is returned invisibly with:

normal

the theoretical normal quantiles,

residuals

the empirical quantile residuals.

References

Dunn KP, Smyth GK (1996). “Randomized Quantile Residuals.” Journal of Computational and Graphical Statistics, 5, 1–10.

See Also

qresiduals, qqnorm

Examples

## linear regression models (homoscedastic Gaussian response)
m <- lm(dist ~ speed, data = cars)
qqrplot(m)
qqrplot(m, trafo = NULL)

[Package topmodels version 0.0-1 Index]