spreadLevelPlot {car}  R Documentation 
Creates plots for examining the possible dependence of spread on level, or an extension of these plots to the studentized residuals from linear models.
spreadLevelPlot(x, ...) slp(...) ## S3 method for class 'formula' spreadLevelPlot(x, data=NULL, subset, na.action, main=paste("SpreadLevel Plot for", varnames[response], "by", varnames[response]), ...) ## Default S3 method: spreadLevelPlot(x, by, robust.line=TRUE, start=0, xlab="Median", ylab="HingeSpread", point.labels=TRUE, las=par("las"), main=paste("SpreadLevel Plot for", deparse(substitute(x)), "by", deparse(substitute(by))), col=carPalette()[1], col.lines=carPalette()[2], pch=1, lwd=2, grid=TRUE, ...) ## S3 method for class 'lm' spreadLevelPlot(x, robust.line=TRUE, xlab="Fitted Values", ylab="Absolute Studentized Residuals", las=par("las"), main=paste("SpreadLevel Plot for\n", deparse(substitute(x))), pch=1, col=carPalette()[1], col.lines=carPalette()[2:3], lwd=2, grid=TRUE, id=FALSE, smooth=TRUE, ...) ## S3 method for class 'spreadLevelPlot' print(x, ...)
x 
a formula of the form 
data 
an optional data frame containing the variables to be plotted.
By default the variables are taken from the environment from which

subset 
an optional vector specifying a subset of observations to be used. 
na.action 
a function that indicates what should happen when the data contain 
by 
a factor, numeric vector, or character vector defining groups. 
robust.line 
if 
start 
add the constant 
main 
title for the plot. 
xlab 
label for horizontal axis. 
ylab 
label for vertical axis. 
point.labels 
if 
las 
if 
col 
color for points; the default is the first entry
in the current car palette (see 
col.lines 
for the default method, the line color, defaulting to the second entry in the car color palette;
for the 
pch 
plotting character for points; default is 
lwd 
line width; default is 
grid 
If TRUE, the default, a lightgray background grid is put on the graph 
id 
controls point identification; if 
smooth 
specifies the smoother to be used along with its arguments; if 
... 
arguments passed to plotting functions. 
Except for linear models, computes the statistics for, and plots, a Tukey spreadlevel plot of log(hingespread) vs. log(median) for the groups; fits a line to the plot; and calculates a spreadstabilizing transformation from the slope of the line.
For linear models, plots log(abs(studentized residuals) vs. log(fitted values). Point labeling was added in November, 2016.
The function slp
is an abbreviation for spreadLevelPlot
.
An object of class spreadLevelPlot
containing:
Statistics 
a matrix with the lowerhinge, median, upperhinge, and hingespread
for each group. (Not for an 
PowerTransformation 
spreadstabilizing power transformation, calculated as 1  slope of the line fit to the plot. 
John Fox jfox@mcmaster.ca
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.
Hoaglin, D. C., Mosteller, F. and Tukey, J. W. (Eds.) (1983) Understanding Robust and Exploratory Data Analysis. Wiley.
spreadLevelPlot(interlocks + 1 ~ nation, data=Ornstein) slp(lm(interlocks + 1 ~ assets + sector + nation, data=Ornstein))