View source: R/regrresidplot.R
regrresidplot | R Documentation |
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.
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", ...)
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 |
resid.plot |
Logical or character. Should the residuals from |
fit.line |
Logical. Should the fitted regression line from |
lm.object |
Linear model object of y against some function of x. The default value
is the simple linear regression of |
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 |
col.fit |
Color of fitted line. |
col.resid |
Color of residuals, either lines or squares depending on the value of
|
... |
Additional arguments to the panel functions. |
regrresidplot
returns a "trellis"
object.
panel.residSquare
is a panel function with no useful returned value.
Richard M. Heiberger <rmh@temple.edu>
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)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.