BoxTidwell.glm | R Documentation |
Computes the Box-Tidwell power transformations of the predictors in a generalized linear model.
## S3 method for class 'glm'
BoxTidwell(
object,
transf,
epsilon = 1e-04,
maxiter = 30,
trace = FALSE,
digits = max(3, getOption("digits") - 2),
...
)
object |
an object of the class glm. |
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.lm
###### Example 1: Skin cancer in women
data(skincancer)
fit1 <- glm(cases ~ age + city, offset=log(population), family=poisson(log), data=skincancer)
AIC(fit1)
BoxTidwell(fit1, transf= ~ age)
fit1 <- update(fit1,formula=. ~ I(age^(-1/2)) + city)
AIC(fit1)
###### Example 3: Gas mileage
data(Auto, package="ISLR")
fit3 <- glm(mpg ~ horsepower + weight, family=inverse.gaussian(log), data=Auto)
AIC(fit3)
BoxTidwell(fit3, transf= ~ horsepower + weight)
fit3 <- update(fit3,formula=. ~ I(horsepower^(-1/3)) + weight)
AIC(fit3)
###### Example 4: Advertising
data(advertising)
fit4 <- glm(sales ~ TV + radio, family=gaussian(log), data=advertising)
AIC(fit4)
BoxTidwell(fit4, transf= ~ TV)
fit4 <- update(fit4,formula=. ~ I(TV^(1/10)) + radio)
AIC(fit4)
###### Example 5: Leukaemia Patients
data(leuk, package="MASS")
fit5 <- glm(ifelse(time>=52,1,0) ~ ag + wbc, family=binomial, data=leuk)
AIC(fit5)
BoxTidwell(fit5, transf= ~ wbc)
fit5 <- update(fit5,formula=. ~ ag + I(wbc^(-0.18)))
AIC(fit5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.