S3 Class "boxcox"
Objects of S3 class "boxcox"
are returned by the EnvStats
function boxcox
, which computes objective values for
user-specified 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 Box-Cox 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, non-missing observations. |
data.name |
The name of the data object used for the Box-Cox 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 Q-Q plots or
Tukey Mean-Difference Q-Q plots.
data |
Numeric vector containing the data actually used for the Box-Cox computations (i.e., the original data without any missing or infinite values). |
Since objects of class "boxcox"
are lists, you may extract
their components with the $
and [[
operators.
Steven P. Millard (EnvStats@ProbStatInfo.com)
# 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 Box-Cox 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 Box-Cox 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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.