Learn R Programming

car (version 0.8-4)

box.cox.var: Constructed Variable for Box-Cox Transformation

Description

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

Usage

box.cox.var(y)

Arguments

y
response variable.

Value

  • a numeric vector of the same length as y.

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.

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. (1997) Applied Regression, Linear Models, and Related Methods. Sage.

See Also

boxcox, box.cox, box.cox.powers, box.cox.axis, av.plots

Examples

Run this code
data(Ornstein)
mod<-lm(interlocks+1~assets, data=Ornstein)
mod.aux<-update(mod, .~.+box.cox.var(interlocks+1))
summary(mod.aux)
## Call:
## lm(formula = interlocks + 1 ~ assets + box.cox.var(interlocks + 
##     1), data = Ornstein)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -23.189  -6.701   0.541   6.773  12.051 
## 
## Coefficients:
##                               Estimate Std. Error t value Pr(>|t|)
## (Intercept)                  1.461e+01  5.426e-01  26.920   <2e-16
## assets                      -7.142e-05  5.119e-05  -1.395    0.164
## box.cox.var(interlocks + 1)  7.427e-01  4.136e-02  17.956   <2e-16
## 
## Residual standard error: 7.247 on 245 degrees of freedom
## Multiple R-Squared: 0.7986,     Adjusted R-squared: 0.797 
## F-statistic: 485.7 on 2 and 245 degrees of freedom,     p-value:     0 
av.plots(mod.aux, "box.cox.var(interlocks + 1)")

Run the code above in your browser using DataLab