Learn R Programming

BHH2 (version 2016.05.31)

lambdaPlot: 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 $\lambda$ 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 $\lambda$ 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.

Value

The function returns an invisible list with components:
lambda
numeric. Vector of length m with the different values of $\lambda$.
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.

Details

The response is transformed as $Y=(y^\lambda - 1)/\lambda$ for each value of $\lambda$ (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.

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.

Examples

Run this code
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")

# 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)

# 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)

Run the code above in your browser using DataLab