Description Details Value Methods Note Author(s) See Also Examples
Objects of S3 class "boxcox"
are returned by the EnvStats
function boxcox
, which computes objective values for
userspecified powers, or computes the optimal power for the specified
objective.
Objects of class "boxcox"
are lists that contain
information about the powers that were used, the objective that was used,
the values of the objective for the given powers, and whether an
optimization was specified.
Required Components
The following components must be included in a legitimate list of
class "boxcox"
.
lambda 
Numeric vector containing the powers used in the BoxCox transformations.
If the value of the 
objective 
Numeric vector containing the value(s) of the objective for the given value(s)
of λ that are stored in the component 
objective.name 
character string indicating the objective that was used. The possible values are

optimize 
logical scalar indicating whether the objective was simply evaluted at the
given values of 
optimize.bounds 
Numeric vector of length 2 with a names attribute indicating the bounds within
which the optimization took place. When 
eps 
finite, positive numeric scalar indicating what value of 
sample.size 
Numeric scalar indicating the number of finite, nonmissing observations. 
data.name 
The name of the data object used for the BoxCox computations. 
bad.obs 
The number of missing ( 
Optional Component
The following component may optionally be included in a legitimate
list of class "boxcox"
. It must be included if you want to call the
function plot.boxcox
and specify QQ plots or
Tukey MeanDifference QQ plots.
data 
Numeric vector containing the data actually used for the BoxCox computations (i.e., the original data without any missing or infinite values). 
Generic functions that have methods for objects of class
"boxcox"
include:
plot
, print
.
Since objects of class "boxcox"
are lists, you may extract
their components with the $
and [[
operators.
Steven P. Millard ([email protected])
boxcox
, plot.boxcox
, print.boxcox
,
boxcoxLm.object
.
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63  # Create an object of class "boxcox", then print it out.
# (Note: the call to set.seed simply allows you to reproduce this example.)
set.seed(250)
x < rlnormAlt(30, mean = 10, cv = 2)
dev.new()
hist(x, col = "cyan")
boxcox.list < boxcox(x)
data.class(boxcox.list)
#[1] "boxcox"
names(boxcox.list)
# [1] "lambda" "objective" "objective.name"
# [4] "optimize" "optimize.bounds" "eps"
# [7] "data" "sample.size" "data.name"
#[10] "bad.obs"
boxcox.list
#Results of BoxCox Transformation
#
#
#Objective Name: PPCC
#
#Data: x
#
#Sample Size: 30
#
# lambda PPCC
# 2.0 0.5423739
# 1.5 0.6402782
# 1.0 0.7818160
# 0.5 0.9272219
# 0.0 0.9921702
# 0.5 0.9581178
# 1.0 0.8749611
# 1.5 0.7827009
# 2.0 0.7004547
boxcox(x, optimize = TRUE)
#Results of BoxCox Transformation
#
#
#Objective Name: PPCC
#
#Data: x
#
#Sample Size: 30
#
#Bounds for Optimization: lower = 2
# upper = 2
#
#Optimal Value: lambda = 0.04530789
#
#Value of Objective: PPCC = 0.9925919
#
# Clean up
#
rm(x, boxcox.list)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.