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

Turner, Heather Heather.Turner at warwick.ac.uk
Tue Jan 16 10:29:00 CET 2007


Hi Johann,

The current version of gnm is unable to fit this type of model, though a
new version with more flexibility is soon to be released.

In any case, you probably want to use nls or gnls, depending on the
assumptions that can be made about the model errors. For nls it is usual
to assume that the errors are normally distributed with mean zero and
constant variance, though the normal assumption is not strictly
necessary. If you have reason to think the errors are correlated and/or
have unequal variances, then gnls would be appropriate.

The examples on ?nls may be enough to get you started,

Heather

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Johann Hibschman
Sent: 16 January 2007 04:05
To: Turner, Heather; r-help
Subject: [R] nonlinear regression: nls, gnls, gnm, other?

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,

Johann

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list