boxcox.nls | R Documentation |
Finds the optimal Box-Cox transformation for non-linear regression models.
boxcox.nls(object, lambda = seq(-2, 2, 1/10), plotit = TRUE, start, eps = 1/50, bcAdd = 0, level = 0.95,
xlab = expression(lambda), ylab = "log-likelihood", ...)
bcSummary(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~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)
bcSummary(ryegrass.m2)
## Fitting the Michaelis-Menten model without self starter
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)
bcSummary(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)
bcSummary(L.minor.m4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.