Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/plot.boxcoxLm.R

Plot the results of calling the function `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.

1 2 3 4 5 6 7 8 9 10 | ```
## 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, ...)
``` |

`x` |
an object of class |

`plot.type` |
character string indicating what kind of plot to create. Only one particular
plot type will be created, unless |

`same.window` |
logical scalar indicating whether to produce all plots in the same graphics
window ( |

`ask` |
logical scalar supplied to the function |

`points.col` |
numeric scalar determining the color of the points in the plot. The default
value is |

**The following arguments can be supplied when plot.type="Q-Q Plots",**

`plot.type="Tukey M-D Q-Q Plots"`

, or `plot.type="All"`

(supplied to `qqPlot`

):`plot.pos.con` |
numeric scalar between 0 and 1 containing the value of the plotting position
constant used to construct the Q-Q plots and/or Tukey Mean-Difference Q-Q plots.
The default value is |

`estimate.params` |
logical scalar indicating whether to compute quantiles based on estimating the
distribution parameters ( |

`equal.axes` |
logical scalar indicating whether to use the same range on the |

`add.line` |
logical scalar indicating whether to add a line to the plot. If |

`qq.line.type` |
character string determining what kind of line to add to the plot when |

`duplicate.points.method` |
a character string denoting how to plot points with duplicate |

`line.col` |
numeric scalar determining the color of the line in the plot. The default value
is |

`line.lwd` |
numeric scalar determining the width of the line in the plot. The default value
is |

`line.lty` |
numeric scalar determining the line type (style) of the line in the plot.
The default value is |

`digits` |
scalar indicating how many significant digits to print for the distribution
parameters and the value of the objective in the sub-title. The default
value is the current setting of |

**Graphics parameters:**

`cex.main, cex.sub, main, sub, xlab, ylab, xlim, ylim, ...` |
graphics parameters; see |

The function `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:

Objective vs.

*λ*.Observed Quantiles vs. Normal Quantiles (Q-Q Plot) for the residuals of the linear model based on transformed values of the response variable for each of the values of

*λ*.Tukey Mean-Difference Q-Q Plots for the residuals of the linear model based on transformed values of the response variable for each of the values of

*λ*.

See the help files for `boxcox`

and `qqPlot`

for more
information.

`plot.boxcoxLm`

invisibly returns the first argument, `x`

.

Steven P. Millard ([email protected])

Chambers, J. M. and Hastie, T. J. (1992). *Statistical Models in S*.
Wadsworth & Brooks/Cole.

`qqPlot`

, `boxcox`

, `boxcoxLm.object`

,
`print.boxcoxLm`

, Data Transformations, `plot`

.

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 31 32 33 34 35 | ```
# 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()
``` |

EnvStats documentation built on Oct. 10, 2017, 1:05 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.