plotresid: Simple analysis of model residuals

View source: R/plotresid.R

plotresidR Documentation

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, least.rect, betareg or glmmTMB models.

Usage

plotresid(model, shapiro = FALSE)

Arguments

model

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

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"), except for betareg models where standardized weighted residuals 2 are used (see residuals.betareg).

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.

Author(s)

Maxime HERVE <maxime.herve@univ-rennes1.fr>

See Also

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


RVAideMemoire documentation built on Nov. 6, 2023, 5:07 p.m.