regrresidplot

0th

Percentile

Draw a plot of y vs x from a linear model object, with residuals indicated by lines or squares.

Draw a plot of response vector y vs predictor variable x from a linear model object all of whose predictors are a function of x, with residuals indicated by lines or squares.

Keywords
hplot
Usage
regrresidplot(x, y, resid.plot = FALSE, fit.line=TRUE,
              lm.object = lm(y ~ x), x.name = names(lm.object$model)[2],
              col = trellis.par.get()$plot.symbol$col,
              col.yhat = NULL, col.fit = "gray80", col.resid = "gray40", ...)

panel.residSquare(x, y, yhat, resid.plot = FALSE, col = "black", ...)

Arguments
x

Predictor variable. Must be a vector or a single column.

y

Response variable. Must be a vector or a single column.

yhat

Predicted value of y based on the model in lm.object over the xlim range of the plot.

resid.plot

Logical or character. Should the residuals from lm.object be plotted, and how? Default is FALSE. Alternatives are TRUE for lines and "square" for squares.

fit.line

Logical. Should the fitted regression line from lm.object be plotted? Default TRUE.

lm.object

Linear model object of y against some function of x. The default value is the simple linear regression of lm(y ~ x).

x.name

Name of $x$-variable to be used in the construction of the fitted values.

col

Color of observed points.

col.yhat

Color of fitted points. Default is NULL.

col.fit

Color of fitted line.

col.resid

Color of residuals, either lines or squares depending on the value of resid.plot.

Additional arguments to the panel functions.

Value

regrresidplot returns a "trellis" object. panel.residSquare is a panel function with no useful returned value.

Aliases
  • regrresidplot
  • panel.residSquare
Examples
# NOT RUN {
data(fat)
fat.lm <- lm(bodyfat ~ abdomin, data=fat)

AA <- regrresidplot(fat$abdomin, fat$bodyfat, xlim=c(70,185), ylim=c(0,50))
BB <- regrresidplot(fat$abdomin, fat$bodyfat, xlim=c(70,185), ylim=c(0,50),
                    resid.plot="line")
CC <- regrresidplot(fat$abdomin, fat$bodyfat, xlim=c(70,185), ylim=c(0,50),
                    resid.plot="square")

update(between=list(y=1),
       c("Residuals Not Displayed"=AA,
         "Residual Lines"=BB,
         "Residual Squares"=CC, layout=c(1,3)))
# }
Documentation reproduced from package HH, version 3.1-35, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.