inv.tran.plot {alr3}R Documentation

Choose a predictor transformation visually or numerically

Description

inv.tran.plot draws a two-dimensional scatterplot of Y versus X, along with the OLS fit from the regression of Y on (Y^(lam)-1)/lam. inv.tran.estimate find the nonlinear least squares estimate of lambda and its standard error.

Usage

inv.tran.plot(x,y,lambda=c(-1,0,1),lty=1:(1+length(lambda)),
        col=rainbow(length(lambda)+1),xlab=deparse(substitute(x)),
        ylab=deparse(substitute(y)),family="box.cox",optimal=TRUE,
        key=FALSE,...)

inv.tran.estimate(x,y,family="box.cox",...)

Arguments

x The predictor variable
y The response variable
lambda The powers used in the plot. The optimal power than minimizes the residual sum of squares is always added unless optimal is FALSE.
family The transformation family to use, "box.cox", "yeo.johnson", or a user-defined family.
optimal Include the optimal value of lambda?
lty line types corresponding to the powers
col color corresponding to the powers
key If TRUE, draw a key and use locator to find it; if FALSE do not draw a key. If a vector of length 2, draw the upper left corner of the key at that point.
xlab Label for the horizontal axis.
ylab Label for the vertical axis.
... additional arguments passed to other methods.

Value

inv.tran.plot returns a graph and a data.frame with lam in the first column, and the residual sum of squares from the regression for that lam in the second column.
inv.tran.estimate returns a list with elements lambda for the estimate, se for its standard error, and RSS, the minimum value of the residual sum of squares.

Author(s)

Sanford Weisberg, sandy@stat.umn.edu

References

Weisberg, S. (2005). Applied Linear Regression, third edition. New York: Wiley.

See Also

powtran, inverse.response.plot, optimize, nls

Examples

data(baeskel)
attach(baeskel)
inv.tran.plot(Sulfur,Tension,key=c(.6,450))
ans <-inv.tran.estimate(Sulfur,Tension)
# redraw the plot, including the nls estimate
inv.tran.plot(Sulfur,Tension,lambda=c(ans$lambda,-1,0,1),key=c(.6,450))

[Package alr3 version 1.0.9 Index]