Learn R Programming

RVAideMemoire (version 0.9-80)

plotresid: Simple analysis of model residuals

Description

Plots residuals of a model against fitted values and for some models a QQ-plot of these residuals. Optionally, a Shapiro-Wilk test can be performed on residuals. The function deals with lm (including glm, lmList, lmList, glm.nb, mlm and manova), lmer, glmer, glmmPQL, glmmadmb, lme, gls, nls, nlsList, survreg and least.rect models.

Usage

plotresid(model, shapiro = FALSE)

Arguments

model

an object of class "lm", "lmList", "lmList4", "merMod", "glmmadmb", "lme", "glmmPQL", "gls", "nls", "nlsList", "survreg" or "least.rect".

shapiro

logical. If TRUE and if model is based on a Gaussian distribution, a Shapiro-Wilk test is performed on residuals.

Details

Response residuals are used for linear models, non linear models and generalized linear models based on an identity link (except with "quasi" distributions where response residuals are used only if variance="constant"). Pearson or studentized residuals are used whenever there is a link function which is not identity (and with "quasi" distributions when variance is not "constant").

QQ-plots and Shapiro-Wilk tests are available whenever the model is based on a Gaussian distribution (and with "quasi" distributions when variance="constant").

With a mlm or manova model, only a multivariate QQ-plot is drawn. The test performed when shapiro=TRUE is a Shapiro-Wilk test for multivariate normality.

See Also

lm, lmList, lmList, glm, glm.nb, manova, lmer, glmer, lmer, glmer.nb, lme, glmmPQL, gls, nls, nlsList, survreg, least.rect, qresiduals, qqPlot, shapiro.test, mqqnorm, mshapiro.test