[R] nls.control()

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Sep 4 12:06:09 CEST 2008


On Wed, 3 Sep 2008, Ranney, Steven wrote:

>>>
>>> and I'm trying to fit a simple Von Bertalanffy growth curve with program:
>>>
>>> VonB=nls(TL~Linf*(1-exp(-k*(age-t0))), data=box5.4,
>>>     start=list(Linf=1000, k=0.1, t0=0.1), trace=TRUE)
>>> ...
>>> Everything works as it should right up until the confint(VonB) statement.
>>> When I ask
>>> for the confidence intervals, R goes through the process then stops and gives
>>>
>>> "Error in prof$getProfile() :
>>>   step factor 0.000488281 reduced below 'minFactor' of 0.000976562".
>>>
>>> However, when I use nls.control=(minFactor=0.000001) OR
>>> nls.control(minFactor=0.000001),
>
>> In my experience, it never helps to reduce the control factors once this error
>> comes up; it is a problem that by profiling you hit a boundary where
>> convergence problems are serious.
>>
>> Suggestions: first, try with some smaller p-value, e.g. 0.8 or 0.7 instead of
>> the default of 0.95; profiling will stay in safer region.
>>
>> It may be possible to use algorithm "port" in combination with lower/upper, but
>> I am not sure if this is honoured by profile.
>>
>> Dieter
>
> I adjusted the nls() statement by adding the algorithm="port" statement.  Without changing the
> confint(vonB) request or including a lower/upper statement (I'm still not sure what they do),
> I was given
>
>         2.5%     97.5%
> Linf 462.8386        NA
> k          NA 0.6944959
> t0         NA 0.7973458
>
> It's not until I get down to confint(VonB, level=.31) that I get confidence interval values for
> all of the parameter estimates in the model.  Any thoughts or ideas as to why?

For the reason Dieter Menne has already told you.  When profiling you are 
trying to fit models that cannot be fitted.  I guess you need constraints 
on your parameters (as DM suggested), or perhaps better, to transform 
them.

There are few things with nls profiling in R 2.7.x that are too 
conservative, so you might like to try R-devel (but I suspect you will 
still get into problems at 5%).

>
>
> Steven H. Ranney
>
> Graduate Research Assistant (Ph.D)
> USGS Montana Cooperative Fishery Research Unit
> Montana State University
> P.O. Box 173460
> Bozeman, MT 59717-3460
>
> phone: (406) 994-6643
> fax: (406) 994-7479
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list