These functions display index plots of dfbeta (effect on coefficients of deleting each observation in turn) and dfbetas (effect on coefficients of deleting each observation in turn, standardized by a deleted estimate of the coefficient standard error). In the plot of dfbeta, horizontal lines are drawn at 0 and +/- one standard error; in the plot of dfbetas, horizontal lines are drawn and 0 and +/- 1.
dfbetaPlots(model, ...)dfbetasPlots(model, ...)
# S3 method for lm
dfbetaPlots(model, terms= ~ ., intercept=FALSE, layout=NULL, ask,
main, xlab, ylab, labels=rownames(dfbeta),
id.method="y",
id.n=if(id.method[1]=="identify") Inf else 0, id.cex=1,
id.col=carPalette()[1], id.location="lr", col=carPalette()[1], grid=TRUE, ...)
# S3 method for lm
dfbetasPlots(model, terms=~., intercept=FALSE, layout=NULL, ask,
main, xlab, ylab,
labels=rownames(dfbetas), id.method="y",
id.n=if(id.method[1]=="identify") Inf else 0, id.cex=1,
id.col=carPalette()[1], id.location="lr", col=carPalette()[1], grid=TRUE, ...)
model object produced by lm
or glm
.
A one-sided formula that specifies a subset of the terms in the model.
One dfbeta or dfbetas plot is drawn for each regressor. The default
~.
is to plot against all terms in the model with the exception of an intercept. For example, the
specification terms = ~.-X3
would plot against all terms
except for X3
. If this argument is a quoted name of one of the terms, the
index plot is drawn for that term only.
Include the intercept in the plots; default is FALSE
.
If set to a value like c(1, 1)
or c(4, 3)
, the layout
of the graph will have this many rows and columns. If not set, the program
will select an appropriate layout. If the number of graphs exceed nine, you
must select the layout yourself, or you will get a maximum of nine per page.
If layout=NA
, the function does not set the layout and the user can
use the par
function to control the layout, for example to have
plots from two models in the same graphics window.
The title of the graph; if missing, one will be supplied.
Horizontal axis label; defaults to "Index"
.
Vertical axis label; defaults to coefficient name.
If TRUE
, ask the user before drawing the next plot; if FALSE
, the default, don't ask.
optional additional arguments to be passed to plot
, points
, and showLabels
Arguments for the labelling of
points. The default is id.n=0
for labeling no points. See
showLabels
for details of these arguments.
color for points; defaults to the first entry in the color carPalette
.
If TRUE
, the default, a light-gray background grid is put on the
graph
NULL
. These functions are used for their side effect: producing
plots.
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.
# NOT RUN {
dfbetaPlots(lm(prestige ~ income + education + type, data=Duncan))
dfbetasPlots(glm(partic != "not.work" ~ hincome + children,
data=Womenlf, family=binomial))
# }
Run the code above in your browser using DataLab