Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/spreadLevelPlot.R
Creates plots for examining the possible dependence of spread on level, or an extension of these plots to the studentized residuals from linear models.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | spreadLevelPlot(x, ...)
slp(...)
## S3 method for class 'formula'
spreadLevelPlot(x, data=NULL, subset, na.action,
main=paste("Spread-Level Plot for", varnames[response],
"by", varnames[-response]), ...)
## Default S3 method:
spreadLevelPlot(x, by, robust.line=TRUE,
start=0, xlab="Median", ylab="Hinge-Spread", point.labels=TRUE, las=par("las"),
main=paste("Spread-Level Plot for", deparse(substitute(x)),
"by", deparse(substitute(by))), col=palette()[1], col.lines=palette()[2],
pch=1, lwd=2, grid=TRUE, ...)
## S3 method for class 'lm'
spreadLevelPlot(x, robust.line=TRUE,
smoother=loessLine, smoother.args=list(),
xlab="Fitted Values",
ylab="Absolute Studentized Residuals", las=par("las"),
main=paste("Spread-Level Plot for\n", deparse(substitute(x))),
pch=1, col=palette()[1], col.lines=palette()[2], col.smoother=palette()[3],
lwd=2, grid=TRUE, labels,
id.method = "mahal",
id.n = if(id.method[1]=="identify") Inf else 0,
id.cex=1, id.col=palette()[1], id.location="lr", ...)
## 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 |
smoother |
a function to draw a nonparametric-regression smooth; the default is |
smoother.args |
a list of named values to be passed to the smoother function; the specified elements of the
list depend upon the smoother (see |
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 color palette (see |
col.lines |
color for lines; default is the second entry in the current palette |
col.smoother |
color for smooth line; default is third entry in the current palette. |
pch |
plotting character for points; default is |
lwd |
line width; default is |
grid |
If TRUE, the default, a light-gray background grid is put on the graph |
id.method,labels,id.n,id.cex,id.col,id.location |
Arguments for the labelling of
points. The default is |
... |
arguments passed to plotting functions. |
Except for linear models, computes the statistics for, and plots, a Tukey spread-level plot of log(hinge-spread) vs. log(median) for the groups; fits a line to the plot; and calculates a spread-stabilizing 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 lower-hinge, median, upper-hinge, and hinge-spread
for each group. (Not for an |
PowerTransformation |
spread-stabilizing power transformation, calculated as 1 - slope of the line fit to the plot. |
John Fox jfox@mcmaster.ca
Fox, J. (2008) Applied Regression Analysis and Generalized Linear Models, Second Edition. Sage.
Fox, J. and Weisberg, S. (2011) An R Companion to Applied Regression, Second Edition, Sage.
Hoaglin, D. C., Mosteller, F. and Tukey, J. W. (Eds.) (1983) Understanding Robust and Exploratory Data Analysis. Wiley.
1 2 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.