boxcox
when the argument
x
supplied to boxcox
is an object of class "lm"
.
Three different kinds of plots are available.
The function plot.boxcoxLm
is automatically called by plot
when given an object of class "boxcoxLm"
. The names of other functions
associated with Box-Cox transformations are listed under Data Transformations.## S3 method for class 'boxcoxLm':
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, ...)
"boxcoxLm"
. See boxcoxLm.object
for details.plot.type="All"
, in which case all plots
will be created sequentially. The possible values of plot.type
are:same.window=TRUE
; the default), or to create a new graphics
window for each separate plot (same.window=FALSE
). The argument is
relevdevAskNewPage
, indicating
whether to prompt the user before creating a new plot within a single graphics
window. This argument is ignored when pl
points.col=1
. See the entry for col
in the Rhelp file for
par
for more information.plot.pos.con=0.375
. See the help files for
estimate.params=TRUE
) or using the
distribution parameters for a standard normal distribution (i.e,
mean=0
, plot.type="Q-Q Plots"
. The default value is
TRUE
if qq.line.type="0-1"
or estimate.params=TRUE
,
otherwisadd.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
anplot.type="Q-Q Plots"
. Possible values are "least squares"
(a least squares line; the default),
"0-1"
(a line with intercept 0 and s"standard"
(a single plotting symbol is plotted;
the default), "jitter"
(a separate plotting symbol is plotted for
eacline.col=1
. See the entry for col
in the Rhelp file for
par
for more information. This argline.lwd=par("cex")
. See the entry for lwd
in the Rhelp file for
par
for more information. line.lty=1
. See the entry for lty
in the Rhelp file for par
for more informatiooptions("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(
plot.boxcoxLm
invisibly returns the first argument, x
.plot.boxcoxLm
is a method for the generic function
plot
for the class "boxcoxLm"
(see boxcoxLm.object
).
It can be invoked by calling plot
and giving it an object of
class "boxcoxLm"
as the first argument, or by calling plot.boxcoxLm
directly, regardless of the class of the object given as the first argument
to plot.boxcoxLm
.
Plots associated with Box-Cox transformations are produced on the current graphics
device. These can be one or all of the following:
boxcox
and qqPlot
for more
information.qqPlot
, boxcox
, boxcoxLm.object
,
print.boxcoxLm
, Data Transformations, plot
.# Create an object of class "boxcoxLm", then plot the results.
# The data frame Environmental.df contains daily measurements of
# ozone concentration, wind speed, temperature, and solar radiation
# in New York City for 153 consecutive days between May 1 and
# September 30, 1973. In this example, we'll model ozone as a
# function of temperature.
# Fit the model with the raw Ozone data
#--------------------------------------
ozone.fit <- lm(ozone ~ temperature, data = Environmental.df)
boxcox.list <- boxcox(ozone.fit)
# Plot PPCC vs. lambda based on Q-Q plots of residuals
#-----------------------------------------------------
dev.new()
plot(boxcox.list)
# Look at Q-Q plots of residuals for the various transformation
#--------------------------------------------------------------
plot(boxcox.list, plot.type = "Q-Q Plots", same.window = FALSE)
# Look at Tukey Mean-Difference Q-Q plots of residuals
# for the various transformation
#-----------------------------------------------------
plot(boxcox.list, plot.type = "Tukey M-D Q-Q Plots", same.window = FALSE)
#==========
# Clean up
#---------
rm(ozone.fit, boxcox.list)
graphics.off()
Run the code above in your browser using DataLab