# boxCoxVariable

##### Constructed Variable for Box-Cox Transformation

Computes a constructed variable for the Box-Cox transformation of the response variable in a linear model.

- Keywords
- manip, regression

##### Usage

`boxCoxVariable(y)`

##### Arguments

- y
response variable.

##### Details

The constructed variable is defined as \(y[\log(y/\widetilde{y}) - 1]\), where
\(\widetilde{y}\) is the geometric mean of `y`

.

The constructed variable is meant to be added to the right-hand-side of the linear model. The t-test for the coefficient of the constructed variable is an approximate score test for whether a transformation is required.

If \(b\) is the coefficient of the constructed variable,
then an estimate of the normalizing power transformation based on the score statistic
is \(1 - b\). An added-variable plot for the constructed
variable shows leverage and influence on the decision to transform `y`

.

##### Value

a numeric vector of the same length as `y`

.

##### References

Atkinson, A. C. (1985)
*Plots, Transformations, and Regression*. Oxford.

Box, G. E. P. and Cox, D. R. (1964)
An analysis of transformations.
*JRSS B* **26** 211--246.

Fox, J. (2008)
*Applied Regression Analysis and Generalized Linear Models*,
Second Edition. Sage.

Fox, J. and Weisberg, S. (2011)
*An R Companion to Applied Regression*, Second Edition, Sage.

##### See Also

##### Examples

```
# NOT RUN {
mod <- lm(interlocks + 1 ~ assets, data=Ornstein)
mod.aux <- update(mod, . ~ . + boxCoxVariable(interlocks + 1))
summary(mod.aux)
# avPlots(mod.aux, "boxCoxVariable(interlocks + 1)")
# }
```

*Documentation reproduced from package car, version 2.1-6, License: GPL (>= 2)*