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.
For the "lm"
method, the response variable in the model is successively
transformed.
symbox(x, ...)
# S3 method for formula
symbox(formula, data=NULL, subset, na.action=NULL, ylab, ...)
# S3 method for default
symbox(x, powers = c(-1, -0.5, 0, 0.5, 1), start,
trans=bcPower, xlab="Powers", ylab, ...)
# S3 method for lm
symbox(x, powers = c(-1, -0.5, 0, 0.5, 1), start, trans=bcPower,
xlab, ylab="Studentized residuals", ...)
a numeric vector.
a one-sided formula specifying a single numeric variable.
as for statistical modeling functions (see, e.g., lm
).
axis labels; if ylab
is missing, a label will be supplied. For the "lm"
method, if xlab
is missing, a label will also be supplied.
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.
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
.
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.
as returned by boxplot
.
Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition. Sage.
# NOT RUN {
symbox(~ income, data=Prestige)
symbox(lm(wages ~ education + poly(age, 2) + sex, data=SLID))
# }
Run the code above in your browser using DataLab