[R] nls - find good starting values

Dieter Menne dieter.menne at menne-biomed.de
Tue Jul 14 10:00:44 CEST 2009




antje-4 wrote:
> 
> I have several data sets, I'd like to fit to a gaussian distribution. 
> I've tried to give an estimate of the mean and the sd of this 
> distribution but still, I run into problems if these estimates are not 
> close enough.
> 
> For example, nls() breaks with this message:
> singular gradient matrix at initial parameter estimates
> 
> I don't know how to avoid these bad start values because their estimate 
> is automated. Better start values are often quite close.
> 
> 

If you really want to fit a single gaussian distribution, there are probably
better ways, for example by using the a QQ plot. For some nls fits, starting
with a slight-off value (e.g. 0.001 instead of 0) might help, but I doubt
this could be a problem with a simple Gaussian distribution.

I many cases, using the log of a parameter you want to force to be >0 works
well; this is the standard method in some fields, e.g. pharmacodynamics.

As a nice tool to learn about nls, try package nlstools.

Dieter



-- 
View this message in context: http://www.nabble.com/nls---find-good-starting-values-tp24474843p24475260.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list