Type ?nls in R for more details!
Examples from R help
DNase1
## using a selfStart model
fm1DNase1
summary(fm1DNase1)
## using conditional linearity
fm2DNase1
data = DNase1,
start = list(xmid = 0, scal = 1),
alg = "plinear", trace = TRUE)
summary(fm2DNase1)
## without conditional linearity
fm3DNase1
data = DNase1,
start = list(Asym = 3, xmid = 0, scal = 1),
trace = TRUE)
summary(fm3DNase1)
## using Port's nl2sol algorithm
fm4DNase1
data = DNase1,
start = list(Asym = 3, xmid = 0, scal = 1),
trace = TRUE, algorithm = "port")
summary(fm4DNase1)
## weighted nonlinear regression
Treated
weighted.MM
{
## Purpose: exactly as white book p. 451 -- RHS for nls()
## Weighted version of Michaelis-Menten model
## ------------------------------------------------------------
## Arguments: 'y', 'x' and the two parameters (see book)
## ------------------------------------------------------------
## Author: Martin Maechler, Date: 23 Mar 2001, 18:48
pred
(resp - pred) / sqrt(pred)
}
Pur.wt
start = list(Vm = 200, K = 0.1),
trace = TRUE)
summary(Pur.wt)
## The two examples below show that you can fit a model to
## artificial data with noise but not to artificial data
## without noise.
x
y
yeps
nls(yeps ~ a + b*x, start = list(a = 0.12345, b = 0.54321),
trace = TRUE)
## Not run:
nls(y ~ a + b*x, start = list(a = 0.12345, b = 0.54321),
trace = TRUE)
## End(Not run)