Skip to content
Prev 172177 / 398506 Next

nls does not accept start values

It is not very clear what you are trying to do here, and
is using a historic anomaly (see the help page).

I am gussing you want to give nls an object containing a formula and 
an expression for the starting value.  It seems you are re-inventing 
self-starting nls models: see ?selfStart and MASS$ ca p. 216.
One way to use them in your example is

mod <- selfStart(~ 1/(a - x), function(mCall, data, LHS) {
     structure(mean(eval(LHS, data)), names="a")
}, "a")

nls(y ~ mod(x, a))

But if you want to follow ypur route, youer starting values would be 
better to be a list that you evaluate in an appropriate context 
(which y is this supposed to be?).  nls() knows where it will find 
variables, but it is not so easy for you to replicate its logic 
without access to its evaluation frames.
On Mon, 2 Mar 2009, Petr PIKAL wrote: