[R] How to have NLME return when convergence not reached

Viechtbauer Wolfgang (STAT) wolfgang.viechtbauer at maastrichtuniversity.nl
Wed Dec 3 10:27:59 CET 2014


Here is a reproducible bug in nlme (reported in 2008) that still crashes R today:

https://stat.ethz.ch/pipermail/r-sig-mixed-models/2008q3/001425.html

Seems to be related to memory corruption (as diagnosed by Martin and William Dunlap at the time):

https://stat.ethz.ch/pipermail/r-sig-mixed-models/2008q3/001429.html
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2008q3/001431.html

I don't know if that is related to the present case, but it sounds a bit like it.

Best,
Wolfgang

--   
Wolfgang Viechtbauer, Ph.D., Statistician   
Department of Psychiatry and Psychology   
School for Mental Health and Neuroscience   
Faculty of Health, Medicine, and Life Sciences   
Maastricht University, P.O. Box 616 (VIJV1)   
6200 MD Maastricht, The Netherlands   
+31 (43) 388-4170 | http://www.wvbauer.com   

> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Martin
> Maechler
> Sent: Wednesday, December 03, 2014 09:26
> To: Bert Gunter
> Cc: r-help at r-project.org; Ramiro Barrantes
> Subject: Re: [R] How to have NLME return when convergence not reached
> 
> >>>>> Bert Gunter <gunter.berton at gene.com>
> >>>>>     on Tue, 2 Dec 2014 14:03:44 -0800 writes:
> 
>     > Yes, Bill almost always has helpful ideas.
>     > Just a comment: If indeed the process is gobbling up too much
> memory,
>     > that might indicate a problem with your function or implementation.
> I
>     > defer to real experts on this, however.
> 
>     > Cheers,
>     > Bert
> 
>     > Bert Gunter
>     > Genentech Nonclinical Biostatistics
>     > (650) 467-7374
> 
> 
> Yes, thank you Bert, it could be entirely Ramiro's function, but
> we don't know as you have not given any indication about what
> the non-linear function is in your nlme() formula.
> 
> The little you wrote _seems_ to indicate a bug in nlme, and if
> that was the case, the bug should be reported and fixed,
> and we (R core - the maintainer of the recommended package nlme)
> would really like to to get a reproducible example.
> 
> If OTOH, it is your nonlinear function that "goes haywire",
> the implicit blame on nlme would not be warranted.
> 
> Martin Maechler,
> ETH Zurich and R Core team
> 
> 
>     > On Tue, Dec 2, 2014 at 1:59 PM, Ramiro Barrantes
>     > <ramiro at precisionbioassay.com> wrote:
>     >> Thanks so much for your reply.  I am using try but nlme never
> returns!!  and I think the process is getting killed by the system as it
> is taking over all the memory.  However, I do like William Dunlap's idea
> of using R.utils::withTimeout to limit the time.
>     >>
>     >> Thanks again for your help!
>     >> ________________________________________
>     >> From: Bert Gunter [gunter.berton at gene.com]
>     >> Sent: Tuesday, December 02, 2014 4:30 PM
>     >> To: Ramiro Barrantes
>     >> Cc: r-help at r-project.org
>     >> Subject: Re: [R] How to have NLME return when convergence not
> reached
>     >>
>     >> ?try
>     >> Or
>     >> ?tryCatch
>     >>
>     >> Bert
>     >>
>     >> Sent from my iPhone -- please excuse typos.
>     >>
>     >>> On Dec 2, 2014, at 12:57 PM, Ramiro Barrantes
> <ramiro at precisionbioassay.com> wrote:
>     >>>
>     >>> Hello,
>     >>>
>     >>> I am trying to fit many hundreds of simulated datasets using NLME
> (it's all in a big loop in R).  Some don't seem to converge.  I am
> working on addressing the issues by perhaps adjusting my simulation, or
> tweaking iteration steps in nlme, etc.  However, when it doesn't
> converge, NLME just hangs, and my program either stalls for hours/days or
> takes over the computer memory and everything crashes eventually.  Is
> there a way to tell nlme to stop when it doesn't seem to be converging
> somehow?   I have been looking at the parameters in nlmeControl() but see
> nothing obvious.
>     >>>
>     >>> Thanks in advance,
>     >>>
>     >>> Ramiro



More information about the R-help mailing list