BoxTidwell.lm | R Documentation |
Computes the Box-Tidwell power transformations of the predictors in a normal linear model.
## S3 method for class 'lm'
BoxTidwell(
object,
transf,
epsilon = 1e-04,
maxiter = 30,
trace = FALSE,
digits = max(3, getOption("digits") - 2),
...
)
object |
an object of the class lm. |
transf |
an one-sided formula giving the quantitative predictors that are candidates for transformation. |
epsilon |
an (optional) numerical value. If the maximum relative change in coefficients is less than epsilon, then convergence is declared. As default, epsilon is set to 0.0001. |
maxiter |
an (optional) positive integer value indicating the maximum number of iterations. By default, maxiter is set to 30. |
trace |
an (optional) logical indicating if should the record of iterations be printed. By default,
trace is set to |
digits |
an (optional) integer value indicating the number of decimal places to be used. |
... |
further arguments passed to or from other methods. |
a list list with components including
marginal | a matrix with estimates, standard errors, and 95
and the p-value of the Wald test to assess the hypothesis H_0:\tau=1 versus H_1:\tau\neq 1 , |
omnibus | a matrix with the statistic and the p-value of the Wald test for null hypothesis that all powers are 1, |
Box G.E.P., Tidwell P.W. (1962) Transformation of the independent variables. Technometrics 4, 531-550.
Fox J. (2016) Applied Regression Analysis and Generalized Linear Models, Third Edition. Sage.
BoxTidwell.glm
###### Example 1: Hill races in Scotland
data(races)
fit1 <- lm(rtime ~ distance + cclimb, data=races)
AIC(fit1)
BoxTidwell(fit1, transf= ~ distance + cclimb)
fit1 <- update(fit1,formula=rtime ~ distance + I(cclimb^2))
AIC(fit1)
###### Example 2: Gasoline yield
fit2 <- lm(mpg ~ hp + wt + am, data=mtcars)
AIC(fit2)
BoxTidwell(fit2, transf= ~ hp + wt)
fit2 <- update(fit2,formula=mpg ~ log(hp) + log(wt) + am)
AIC(fit2)
###### Example 3: New York Air Quality Measurements
fit3 <- lm(log(Ozone) ~ Solar.R + Wind + Temp, data=airquality)
AIC(fit3)
BoxTidwell(fit3, transf= ~ Solar.R + Wind + Temp)
fit3 <- update(fit3,formula=log(Ozone) ~ log(Solar.R) + Wind + Temp)
AIC(fit3)
###### Example 4: Heat capacity of hydrobromic acid
data(heatcap,package="GLMsData")
fit4 <- lm(Cp ~ Temp, data=heatcap)
AIC(fit4)
BoxTidwell(fit4, transf= ~ Temp)
fit4 <- update(fit4,formula=Cp ~ I(Temp^5))
AIC(fit4)
###### Example 5: Age and Eye Lens Weight of Rabbits in Australia
data(rabbits)
fit5 <- lm(log(wlens) ~ age, data=rabbits)
AIC(fit5)
BoxTidwell(fit5, transf= ~ age)
fit5 <- update(fit5,formula=log(wlens) ~ I(age^(-1/3)))
AIC(fit5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.