R: Lambda plot: traces the t and F statistics in Box-Cox...
lambdaPlot
R Documentation
Lambda plot: traces the t and F statistics in Box-Cox transformation of the response
Description
Trace regression coefficients' t-values or F-ratios for different values of λ in
the Box-Cox transformation.
Usage
lambdaPlot(mod, lambda = seq(-1, 1, by = 0.1), stat = "F", global = TRUE,
cex = par("cex"), ...)
Arguments
mod
list. A list of class lm.
lambda
numeric. The values of λ in the Box-Cox transformation. See Details.
stat
character. Either "t" of "F", corresponding to the
coefficients' t-values or F-ratios to display.
global
logical. Applied only for stat="F", if TRUE,
the model's F-ratio is traced, otherwise the coefficients' F-statistics.
cex
numeric. Expansion factor used to label the trace lines.par("cex") bu default.
...
additional graphical parameters passed to plot function.
Details
The response is transformed as
Y=(y^λ - 1)/λ
for each value of λ (lambda) and the model refitted.
The t-values or F-ratios of the coefficients are saved for the display.
If global=TRUE, then the F-ratio of the whole model is
plotted instead.
Value
The function returns an invisible list with components:
lambda
numeric. Vector of length m with the
different values of λ.
t.lambda
matrix (k x m), where m
is the number of coefficients in model mod without the intercept,
with the coefficient's t-values.
f.lambda
matrix (k x m) with the coefficient's F-values.
if global = FALSE, otherwise the matrix is (1 x m), with the
corresponding model F-ratio.
Note
For each value of λ the model is refitted. Computations can be
done more efficiently and will be incorporated in future versions.
Author(s)
Ernesto Barrios
References
Box, G. E. P. and C. Fung (1995)
"The Importance of Data Transformation in Designed Experiments for Life Testing".
Quality Engineering, Vol. 7, No. 3, pp. 625-68.
Box G. E. P, Hunter, J. S. and Hunter, W. C. (2005).
Statistics for Experimenters II. New York: Wiley.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(BHH2)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BHH2/lambdaPlot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: lambdaPlot
> ### Title: Lambda plot: traces the t and F statistics in Box-Cox
> ### transformation of the response
> ### Aliases: lambdaPlot
> ### Keywords: design hplot
>
> ### ** Examples
>
> library(BHH2)
> # Lambda Plot tracing t values.
> data(woolen.data)
> woolen.lm <- lm(y~x1+x2+x3+I(x1^2)+I(x2^2)+I(x3^2)+
+ I(x1*x2)+I(x1*x3)+I(x2*x3)+I(x1*x2*x3),data=woolen.data)
> lambdaPlot(woolen.lm,cex=.8,stat="t")
term label
1 (Intercept)
2 x1 A
3 x2 B
4 x3 C
5 `I(x1^2)` D
6 `I(x2^2)` E
7 `I(x3^2)` F
8 `I(x1 * x2)` G
9 `I(x1 * x3)` H
10 `I(x2 * x3)` I
11 `I(x1 * x2 * x3)` J
>
> # Lambda Plot tracing F values.
> woolen2.lm <- lm(y~x1+x2+x3,data=woolen.data)
> lambdaPlot(woolen2.lm,lambda=seq(-1,1,length=41),stat="F",global=TRUE)
[1] "y"
term label
1 Model A
>
> # Lambda Plot tracing F values.
> data(poison.data)
> poison.lm <- lm(y~treat*poison,data=poison.data)
> lambdaPlot(poison.lm,lambda=seq(-3,1,by=.1),stat="F",global=FALSE)
[1] "y"
term label
1 treat A
2 poison B
3 treat:poison C
>
>
>
>
>
> dev.off()
null device
1
>