View source: R/leveragePlots.R
leveragePlots | R Documentation |
These functions display a generalization, due to Sall (1990) and Cook and Weisberg (1991), of added-variable plots to multiple-df terms in a linear model. When a term has just 1 df, the leverage plot is a rescaled version of the usual added-variable (partial-regression) plot.
leveragePlots(model, terms = ~., layout = NULL, ask,
main, ...)
leveragePlot(model, ...)
## S3 method for class 'lm'
leveragePlot(model, term.name,
id=TRUE, col=carPalette()[1], col.lines=carPalette()[2], lwd=2,
xlab, ylab, main="Leverage Plot", grid=TRUE, ...)
## S3 method for class 'glm'
leveragePlot(model, ...)
model |
model object produced by |
terms |
A one-sided formula that specifies a subset of the numeric regressors, factors and interactions.
One added-variable plot is drawn for each term, either a main effect or an interactions. The default
|
layout |
If set to a value like |
ask |
if |
xlab , ylab |
axis labels; if missing, labels will be supplied. |
main |
title for plot; if missing, a title will be supplied. |
... |
arguments passed down to method functions. |
term.name |
Quoted name of term in the model to be plotted; this argument
is omitted for |
id |
controls point identification; if |
col |
color(s) of points |
col.lines |
color of the fitted line |
lwd |
line width; default is |
grid |
If TRUE, the default, a light-gray background grid is put on the graph |
The function intended for direct use is leveragePlots
.
The model can contain factors and interactions. A leverage plot can be drawn for each term in the model, including the constant.
leveragePlot.glm
is a dummy function, which generates an error message.
NULL
. These functions are used for their side effect: producing
plots.
John Fox jfox@mcmaster.ca
Cook, R. D. and Weisberg, S. (1991). Added Variable Plots in Linear Regression. In Stahel, W. and Weisberg, S. (eds.), Directions in Robust Statistics and Diagnostics. Springer, 47-60.
Fox, J. (2016) Applied Regression Analysis and Generalized Linear Models, Third Edition. Sage.
Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition, Sage.
Sall, J. (1990) Leverage plots for general linear hypotheses. American Statistician 44, 308–315.
avPlots
leveragePlots(lm(prestige~(income+education)*type, data=Duncan))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.