boxcox.nls | R Documentation |
Finds the optimal Box-Cox transformation for non-linear regression models.
## 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, ...)
object |
object of class |
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. |
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.
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.
Christian Ritz, modified by Andrea Onofri
Carroll, R. J. and Ruppert, D. (1988) Transformation and Weighting in Regression, New York: Chapman and Hall (Chapter 4).
For linear regression the analogue is boxcox
.
## Fitting log-logistic model without transformation
ryegrass.m1 <- nls(rootl ~ NLS.L4(conc, b, c, d, e),
data=ryegrass)
summary(ryegrass.m1)
## Fitting the same model with optimal Box-Cox transformation
ryegrass.m2 <- boxcox(ryegrass.m1, plotit = TRUE)
summary(ryegrass.m2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.