Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

symbox

Boxplots for transformations to symmetry


Description

symbox first transforms x to each of a series of selected powers, with each transformation standardized to mean 0 and standard deviation 1. The results are then displayed side-by-side in boxplots, permiting a visual assessment of which power makes the distribution reasonably symmetric.

Usage

symbox(x, ...)
## S3 method for class 'formula'
symbox(formula, data=NULL, subset, na.action=NULL, ylab,  ...)
## Default S3 method:
symbox(x, powers = c(-1, -0.5, 0, 0.5, 1), start, 
	trans=bcPower, xlab="Powers", ylab, ...)

Arguments

x

a numeric vector.

formula

a one-sided formula specifying a single numeric variable.

data, subset, na.action

as for statistical modeling functions (see, e.g., lm).

xlab, ylab

axis labels; if ylab is missing, a label will be supplied.

powers

a vector of selected powers to which x is to be raised. For meaningful comparison of powers, 1 should be included in the vector of powers.

start

a constant to be added to x. If start is missing and trans is bcPower (the default) or bcnPower, then a start will be automatically generated if there are zero or negative values in x, and a warning will be printed; the auto-generated start is the absolute value of the minimum x plus 1 percent of the range of x.

trans

a transformation function whose first argument is a numeric vector and whose second argument is a transformation parameter, given by the powers argument; the default is bcPower, and another possibility is yjPower. bcnPower may also be used, in which case the gamma parameter is set to the value of start.

...

arguments to be passed down.

Value

as returned by boxplot.

Author(s)

Gregor Gorjanc, John Fox jfox@mcmaster.ca.

References

Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition. Sage.

See Also

Examples

symbox(~ income, data=Prestige)

car

Companion to Applied Regression

v3.0-10
GPL (>= 2)
Authors
John Fox [aut, cre], Sanford Weisberg [aut], Brad Price [aut], Daniel Adler [ctb], Douglas Bates [ctb], Gabriel Baud-Bovy [ctb], Ben Bolker [ctb], Steve Ellison [ctb], David Firth [ctb], Michael Friendly [ctb], Gregor Gorjanc [ctb], Spencer Graves [ctb], Richard Heiberger [ctb], Pavel Krivitsky [ctb], Rafael Laboissiere [ctb], Martin Maechler [ctb], Georges Monette [ctb], Duncan Murdoch [ctb], Henric Nilsson [ctb], Derek Ogle [ctb], Brian Ripley [ctb], William Venables [ctb], Steve Walker [ctb], David Winsemius [ctb], Achim Zeileis [ctb], R-Core [ctb]
Initial release
2020-09-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.