plot4in1 {MVQuickGraphs}R Documentation

Plot 4-in-1

Description

Generates a 2x2 panel graph including four residual diagnostic plots as is popular in some other statistics packages. This was initially written to support students learning R for the first time in a regression modeling course. plot4in1 generates four commonly-used residual diagnostic plots that can be used to assess the linear regression assumptions and ensures a consistent, reasonably-pleasing graphical style across each plot.

Usage

plot4in1(out, type="Regular", PP=TRUE, pch=19, col="steelblue", cex=1.2, ...)

Arguments

out

the output of the lm function (an object of class "lm"). The components of greatest importance from this object are residuals (perhaps passed to rstandard of rstudent, depending on type) and fitted.values.

type

the type of residuals to be used. There are three possible values: "Regular", "Standardized", and "Studentized". Using type = "Regular" results in untransformed residuals being used, type = "Standardized" uses standardized residuals (computed using rstandard), and type = "Studentized" uses externally studentized residuals (computed using rstudent).

PP

logical. If PP = TRUE, a Normal Percentile Plot (P-P Plot) is displayed in the top-left panel. If PP = FALSE, a Normal Quantile Plot (Q-Q Plot) is displayed in the top-left panel.

pch

symbol to be used in plotting. pch = 19 is a filled circle (see par).

col

color of symbol specified in pch to be used in graphing. The default is "steelblue" (see par).

cex

character expansion value, used to adjust the size of the symbol specified in pch. The default value is cex = 1.2 (see par).

...

other arguments to be passed to the graphing functions.

Details

plot4in1 creates a 2 by 2 panel using par(mfrow = c(2,2)) and then generates four residual diagnostic plots: a Percentile-Percentile (or Quantile-Quantile plot if PP = FALSE), a scatterplot of the fitted.values against the residuals, a histogram of the residuals, and scatterplot of the residuals against their order, overplotted.

Value

None

See Also

influence.measures for more information about standardized (rstandard) and studentized (rstudent) residuals; qqnorm for more information about the Quantile-Quanitle (Q-Q) plot; par for information about the graphical parameters.

Examples

out <- lm(Girth ~ Volume, data = trees)
plot4in1(out)

[Package MVQuickGraphs version 0.1.2 Index]