Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

residual.plots.lattice

Construct four sets of regression plots: Y against X, residuals against X, partial residuals against X, partial residuals against each X adjusted for all the other X columns.


Description

Construct four sets of regression plots. Response variable $Y$ against each $X_j$, residuals $e$ against each $X_j$, partial residuals plots of $e^j$ against each $X_j$, added variable plots of $e^j$ against the residuals of each $X_j$ adjusted for the other $X$ columns. The slopes shown in the panels of both bottom rows are equal to the regression coefficients.

Usage

residual.plots.lattice(lm.object, X=dft$x, layout=c(dim(X)[2],1),
                       par.strip.text=list(cex=.8),
                       scales.cex=.6,
                       na.action=na.pass,
                       y.relation="same",
                       ...)

Arguments

lm.object

lm.object

X
layout, par.strip.text, ...

lattice arguments. See xyplot.

scales.cex

cex for the scales argument in xyplot.

na.action

See na.action.

y.relation

relation for the y argument to scales argument in xyplot.

Value

"trellis" object.

Author(s)

Richard M. Heiberger <rmh@temple.edu>

See Also

Examples

data(longley)
     longley.lm <- lm( Employed ~ . , data=longley, x=TRUE, y=TRUE)
     residual.plots.lattice(longley.lm)

     ## Not run: 
       longleyResid <- tempfile("longleyResid", fileext = ".pdf")
       pdf(longleyResid, height=9, width=14)
       print(residual.plots.lattice(longley.lm, pch=19),
             A4.left=.0125, panel.width=list(5,"cm"))
       dev.off()
     
## End(Not run)

HH

Statistical Analysis and Data Display: Heiberger and Holland

v3.1-43
GPL (>= 2)
Authors
Richard M. Heiberger
Initial release
2020-11-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.