boxcox
, which returns an
object of class "boxcox"
. Three different kinds of plots are available. The function plot.boxcox
is automatically called by plot
when given an object of class "boxcox"
. The names of other functions
associated with Box-Cox transformations are listed under Data Transformations.
"plot"(x, plot.type = "Objective vs. lambda", same.window = TRUE, ask = same.window & plot.type != "Ojective vs. lambda", plot.pos.con = 0.375, estimate.params = FALSE, equal.axes = qq.line.type == "0-1" || estimate.params, add.line = TRUE, qq.line.type = "least squares", duplicate.points.method = "standard", points.col = 1, line.col = 1, line.lwd = par("cex"), line.lty = 1, digits = .Options$digits, cex.main = 1.4 * par("cex"), cex.sub = par("cex"), main = NULL, sub = NULL, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, ...)
"boxcox"
. See boxcox.object
for details.
plot.type="All"
, in which case all plots
will be created sequentially. The possible values of plot.type
are:
"Objective vs. lambda"
(the default),
"Q-Q Plots"
,
"Tukey M-D Q-Q Plots"
, and
"All"
.
same.window=TRUE
; the default), or to create a new graphics
window for each separate plot (same.window=FALSE
). The argument is
relevant only when plot.type
produces more than one plot (i.e., when
plot.type
is not equal to "Objective vs. lambda"
).
devAskNewPage
, indicating
whether to prompt the user before creating a new plot within a single graphics
window. This argument is ignored when plot.type="Objective vs. lambda"
(since only one plot is produced) or when same.window=FALSE
, otherwise
the default value is ask=TRUE
.
points.col=1
. See the entry for col
in the R help file for
par
for more information.
plot.pos.con=0.375
. See the help files for
qqPlot
for more information and the motivation for this choice.
estimate.params=TRUE
) or using the
distribution parameters for a standard normal distribution (i.e,
mean=0
, sd=1
). The default value is estimate.params=FALSE
because a standard normal Q-Q plot will yield roughly a straight line if the
observations are from any normal distribution. If you specify
plot.type="Tukey M-D Q-Q Plots"
, then you need to set
estiamte.params=TRUE
unless you want to assume the transformed data come
from a standard normal distribution.
plot.type="Q-Q Plots"
. The default value is
TRUE
if
qq.line.type="0-1"
or estimate.params=TRUE
,
otherwise it is FALSE
.
add.line=TRUE
and plot.type="Q-Q Plots"
, a line determined by the value of
qq.line.type
is added to the plot. If add.line=TRUE
and
plot.type="Tukey M-D Q-Q Plots"
, a horizontal line at $y=0$ is added to
the plot. The default value is add.line=TRUE
.
plot.type="Q-Q Plots"
. Possible values are:
"least squares"
(a least squares line; the default),
"0-1"
(a line with intercept 0 and slope 1), and
"robust"
(a line is fit through the first and third quartiles of the
$x$ and $y$ data).
This argument is ignored if add.line=FALSE
.
"standard"
(a single plotting symbol is plotted;
the default), "jitter"
(a separate plotting symbol is plotted for
each duplicate point, where the plotting symbols cluster around the true value
of $x$ and $y$), and "number"
(a single number is plotted at
$(x,y)$ that represents how many duplicate points are at that $(x,y)$
coordinate).
line.col=1
. See the entry for col
in the R help file for
par
for more information. This argument is ignored if
add.line=FALSE
.
line.lwd=par("cex")
. See the entry for lwd
in the R help file for
par
for more information. This argument is ignored if
add.line=FALSE
.
line.lty=1
. See the entry for lty
in the R help file for par
for more information.
This argument is ignored if add.line=FALSE
.
options("digits")
.
par
for more information. The
default value of cex.main
is cex.main=1.4 * par("cex")
.
The default value of cex.sub
is
cex.sub=par("cex")
.
plot.boxcox
invisibly returns the first argument, x
.
plot.boxcox
is a method for the generic function
plot
for the class "boxcox"
(see boxcox.object
).
It can be invoked by calling plot
and giving it an object of
class "boxcox"
as the first argument, or by calling plot.boxcox
directly, regardless of the class of the object given as the first argument
to plot.boxcox
.Plots associated with Box-Cox transformations are produced on the current graphics device. These can be one or all of the following:
See the help files for boxcox
and qqPlot
for more
information.
qqPlot
, boxcox
, boxcox.object
,
print.boxcox
, Data Transformations, plot
.
# Generate 30 observations from a lognormal distribution with
# mean=10 and cv=2, call the function boxcox, and then plot
# the results.
# (Note: the call to set.seed simply allows you to reproduce this example.)
set.seed(250)
x <- rlnormAlt(30, mean = 10, cv = 2)
# Plot the results based on the PPCC objective
#---------------------------------------------
boxcox.list <- boxcox(x)
dev.new()
plot(boxcox.list)
# Look at Q-Q Plots for the candidate values of lambda
#-----------------------------------------------------
plot(boxcox.list, plot.type = "Q-Q Plots", same.window = FALSE)
# Look at Tukey Mean-Difference Q-Q Plots
# for the candidate values of lambda
#----------------------------------------
plot(boxcox.list, plot.type = "Tukey M-D Q-Q Plots", same.window = FALSE)
#==========
# Clean up
#---------
rm(x, boxcox.list)
graphics.off()
Run the code above in your browser using DataLab