vis.boxcox: Interactively visualize Box-Cox transformations

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Explore the Box-Cox family of distributions by plotting data transformed and untransformed and interactively choose values for lambda.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
vis.boxcox(lambda = sample(c(-1,-0.5,0,1/3,1/2,1,2), 1),
           hscale=1.5, vscale=1.5, wait=FALSE)

vis.boxcoxu(lambda = sample( c(-1,-0.5,0,1/3,1/2,1,2), 1),
                        y, xlab=deparse(substitute(y)), 
                        hscale=1.5, vscale=1.5, wait=FALSE)

vis.boxcox.old(lambda = sample(c(-1, -0.5, 0, 1/3, 1/2, 1, 2), 1))

vis.boxcoxu.old(lambda = sample(c(-1, -0.5, 0, 1/3, 1/2, 1, 2), 1))

Arguments

lambda

The true value of lambda to use.

y

Optional data to use in the transform.

xlab

Label for x-axis.

hscale

The horizontal scale, passed to tkrplot.

vscale

The vertical scale, passed to tkrplot.

wait

Should R wait for the demo window to close.

Details

These functions will generate a sample of data and plot the untrasformed data (left panels) and the transformed data (right panels). Initially the value of lambda is 1 and the 2 sets of plots will be identical.

You then adjust the transformation parameter lambda to see how the right panels change.

The function vis.boxcox shows the effect of transforming the y-variable in a simple linear regression.

The function vis.boxcoxu shows a single variable compared to the normal distribution.

Value

The old versions have no useful return value. If wait is FALSE then they will return an invisible NULL, if wait is TRUE then the return value will be a list with the final value of lamda, the original data, and the transformed y (at the final lamda value).

Author(s)

Greg Snow 538280@gmail.com

References

GEP Box; DR Cox. An Analysis of Transformations. Journal of the Royal Statitical Society. Series B, Vol. 26, No. 2 (1964) 211-252

See Also

bct, boxcox in package MASS

Examples

1
2
3
4

Example output



TeachingDemos documentation built on April 2, 2020, 3:01 a.m.