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

1
2
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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)