[R] nls problems (formerly no subject)

Spencer Graves spencer.graves at pdf.com
Thu Aug 28 18:34:57 CEST 2003


	  Please use an informative subject line.  The r-help archives at 
www.r-project.org -> search -> R site search indexes that, and I find 
answers to today's problems in the r-help discussions of yesterday's 
questions.

	  Only yesterday, I was got essentially that error message.  I solved 
it by setting "trace=TRUE" and studying which paramters were moving. 
With that information, I looked at the function and thought of ways to 
reparameterize it to make things more stable.  That helped but did not 
solve the problem.  Ultimately, I fixed two of the most volatile 
parameters to sensible values.  Then nls gave me answers very quickly.

	  An excellent reference on nonlinear regression is Bates and Watts 
(1988) Nonlinear regression and its applications (Wiley).  They talk 
some about reparameterizations.  A major contribution of this book is 
distinguishing between the intrinsic nonlinearity of the problem, which 
cannot be fixed without changing the model, and "parameter effect 
curvature", which can be fixed by just writing the model in a different 
but equivalent way.  Pages 256-259 summarize some 67 different examples 
from published literature.  In each case, parameter effects curvature 
was more than the intrinsic curvature, with the median being a factor of 
16 larger.

	  For my problem yesterday, I did not just restrict myself to 
reparameterizations:  I also considered alternative models with similar 
but formally different behavior.

	  Also, have you considered using "optim" first, then feeding the 
answers to "nls"?  McCullough found a few years ago that it was easier 
for him to get answers if he did it that way, because the S-Plus 
versions of "nls" seems to get lost and quit prematurely, while "optim" 
will at least produce an answer.  If I'm not mistaken, this issue is 
discussed in either McCullough, B. D. (1999) Assessing the reliability 
of statistical software: Part II The American Statistician, 53, 149-159 
or McCullough, B. D. (1998) Assessing the reliability of statistical 
software: Part I The American Statistician, 52, 358-366.  I don't 
remember now which paper had this, but I believe one of them did;  I 
think I'd look at the second first.  (McCullough discussed "nlminb" 
instead of "optim".  The former has been replaced by the latter in R.)

hope this helps.  spencer graves

giovanni caggiano wrote:
> Dear All,
> A couple of questions about the nls package.
> 
> 1. I'm trying to run a nonlinear least squares
> regression but the routine gives me the following
> error message:
> 
>  step factor 0.000488281 reduced below `minFactor' of
> 0.000976563
> 
> even though I previously wrote the following command: 
> nls.control(minFactor = 1/4096), which should set the
> minFactor to a lower level than the default one,
> 1/1024=0.000976563. 
> Is there any way of setting the new minfactor to a
> lower level?
> 
> 2. Is it possible to set some constraints upon the
> parameters to be estimated in a nls regression?
> 
> Thanks,
> Giovanni
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list