[R] nonlinear regression: nls, gnls, gnm, other?

Johann Hibschman johannh at gmail.com
Tue Jan 16 05:04:32 CET 2007

Hi all,

I'm trying to fit a nonlinear (logistic-like) regression, and I'd like
to get some recommendations for which package to use.

The expression I want to fit is something like:

y ~ A * exp(X * Beta1) / (1 + exp(-(x + X * Beta2 - xmid)/scal))

Basically, it's a logistic function, but I want to be able to modify
the saturation amplitude by a few parameters (Beta1) and shift the
inflection point around with a few other parameters (Beta2).  I have a
ton of data, but I often have trouble getting the routine to fit.
(I've been using nlin in SAS, which seems sloppier in terms of
accepted convergence.)

Now, from what I can tell, I can use nls, gnls, or gnm to fit
something like this, but I can't tell which would be better, or if
there's something else I should be trying.  To do this right, though,
I have to do a lot more reading, but I'd like to know where to start.

(I have more of a physics/computer background, so I immediately jump
to thinking of regression as minimizing some cost function across a
multidimensional space and then start mumbling about simulated
annealing or some such, but this isn't helping me much in interpreting
the available literature.)

So, does anyone have any suggestions?  I imagine I'm going to have to
pick up a book, but should it be Pinheiro & Bates on nlme, Bates &
Watts, the pdf manual to gnm, or what?

Thanks for any suggestions,


More information about the R-help mailing list