Tukey-Anscombe Plot (Residual vs. Fitted) of a Linear Model
From a linear (or glm) model fitted, produce the so-called Tukey-Anscombe plot. Useful (optional) additions include: 0-line, lowess smooth, 2sigma lines, and automatic labeling of observations.
TA.plot(lm.res, fit= fitted(lm.res), res= residuals(lm.res, type="pearson"), labels= NULL, main= mk.main(), xlab = "Fitted values", draw.smooth= n >= 10, show.call = TRUE, show.2sigma= TRUE, lo.iter = NULL, lo.cex= NULL, par0line = list(lty = 2, col = "gray"), parSmooth = list(lwd = 1.5, lty = 4, col = 2), parSigma = list(lwd = 1.2, lty = 3, col = 4), verbose = FALSE, ...)
lm.res |
|
fit |
fitted values; you probably want the default here. |
res |
residuals to use. Default: Weighted ("Pearson") residuals if weights have been used for the model fit. |
labels |
strings to use as plotting symbols for each point.
Default( |
main |
main title to plot. Default: sophisticated, resulting in
something like "Tukey-Anscombe Plot of : y \~ x" constructed from
|
xlab |
x-axis label for plot. |
draw.smooth |
logical; if |
show.call |
logical; if |
show.2sigma |
logical; if |
lo.iter |
positive integer, giving the number of lowess
robustness iterations. The default depends on the model and
is |
lo.cex |
character expansion ("cex") for lowess and other marginal texts. |
par0line |
a list of arguments (with reasonable defaults) to be passed to
|
parSmooth, parSigma |
each a list of arguments (with reasonable
default) for drawing the smooth curve (if |
verbose |
logical indicating if some construction details should
be reported ( |
... |
further graphical parameters are passed to
|
The above mentioned plot is produced on the current graphic device.
Martin Maechler, Seminar fuer Statistik, ETH Zurich, Switzerland; maechler@stat.math.ethz.ch
plot.lm
which also does a QQ normal plot and more.
data(stackloss) TA.plot(lm(stack.loss ~ stack.x)) example(airquality) summary(lmO <- lm(Ozone ~ ., data= airquality)) TA.plot(lmO) TA.plot(lmO, label = "O") # instead of case numbers if(FALSE) { TA.plot(lm(cost ~ age+type+car.age, claims, weights=number, na.action=na.omit)) } ##--- for aov(.) : ------------- data(Gun, package = "nlme") TA.plot( aov(rounds ~ Method + Physique/Team, data = Gun)) ##--- Not so clear what it means for GLM, but: ------ if(require(rpart)) { # for the two datasets only data(solder, package = "rpart") TA.plot(glm(skips ~ ., data = solder, family = poisson), cex= .6) data(kyphosis, package = "rpart") TA.plot(glm(Kyphosis ~ poly(Age,2) + Start, data=kyphosis, family = binomial), cex=.75) # smaller title and plotting characters }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.