boxcox.nls: Transform-both-sides Box-Cox transformation

boxcox.nlsR Documentation

Transform-both-sides Box-Cox transformation

Description

Finds the optimal Box-Cox transformation for non-linear regression models.

Usage

  ## S3 method for class 'nls'
boxcox(object, lambda = seq(-2, 2, 1/10), plotit = TRUE, 
             start, eps = 1/50, bcAdd = 0, level = 0.95, 
             xlab = expression(lambda), ylab = "log-likelihood", ...)
  ## S3 method for class 'nlsbc'
summary(object, ...)

Arguments

object

object of class nls. For bcSummary the nls fit should have been obtained using boxcox.nls

lambda

numeric vector of lambda values; the default is (-2, 2) in steps of 0.1.

plotit

logical which controls whether the result should be plotted.

start

a list of starting values (optional).

eps

numeric value: the tolerance for lambda = 0; defaults to 0.02.

bcAdd

numeric value specifying the constant to be added on both sides prior to Box-Cox transformation. The default is 0.

level

numeric value: the confidence level required.

xlab

character string: the label on the x axis, defaults to "lambda".

ylab

character string: the label on the y axis, defaults to "log-likelihood".

...

additional graphical parameters.

Details

boxcox.nls is very similar to the boxcox in its arguments. The optimal lambda value is determined using a profile likelihood approach: For each lambda value the non-linear regression model is fitted and the lambda value resulting in thre largest value of the log likelihood function is picked. If a self starter model was used in the model fit, then gradient information will be used in the profiling.

Value

An object of class nls (returned invisibly). If plotit = TRUE a plot of loglik vs lambda is shown indicating a confidence interval (by default 95%) about the optimal lambda value.

Author(s)

Christian Ritz, modified by Andrea Onofri

References

Carroll, R. J. and Ruppert, D. (1988) Transformation and Weighting in Regression, New York: Chapman and Hall (Chapter 4).

See Also

For linear regression the analogue is boxcox.

Examples


## Fitting log-logistic model without transformation
ryegrass.m1<-nls(rootl~c+(d-c)/(1+(conc/e)^b),data=ryegrass, 
                 start=list(b=1,c=0,d=8,e=3))
summary(ryegrass.m1)

## Fitting the same model with optimal Box-Cox transformation
ryegrass.m2 <- boxcox(ryegrass.m1)
summary(ryegrass.m2)
summary(ryegrass.m2)

## Fitting the Michaelis-Menten model without self starter
data(L.minor)
L.minor.m1 <- nls(rate ~ Vm*conc/(K+conc), data = L.minor, 
                  start = list(K=20, Vm=120))
L.minor.m2 <- boxcox(L.minor.m1)
summary(L.minor.m2)

## Fitting the Michaelis-Menten model with self starter
L.minor.m3 <- nls(rate ~ SSmicmen(conc, Vm, K), data = L.minor)
L.minor.m4 <- boxcox(L.minor.m3)
summary(L.minor.m4)

OnofriAndreaPG/aomisc documentation built on Feb. 26, 2024, 8:21 p.m.