From nikko at hailmail.net  Thu Oct 18 17:04:12 2007
From: nikko at hailmail.net (Nicholas Lewin-Koh)
Date: Thu, 18 Oct 2007 11:04:12 -0400
Subject: [Rd] nmle: gnls freezes on difficult case
In-Reply-To: <Pine.LNX.4.64.0710181543370.17479@gannet.stats.ox.ac.uk>
References: <1192717070.9380.1216571837@webmail.messagingengine.com>
	<Pine.LNX.4.64.0710181543370.17479@gannet.stats.ox.ac.uk>
Message-ID: <1192719852.19068.1216582441@webmail.messagingengine.com>

Hi,
Thank you for the pointer, I will make the default in my code optim.
As I specified in my last post it may be my installation. In this
case the problem is that the third parameter (xmid) goes negative and 
the log(xmid) fails in the parameterization I am using. For some
reason nlminb is not exiting gracefully. I can look more into this
later if I get time.

Ideally I should constrain xmid to be strictly positive, how would
I use L-BFGS-B in gnls? gnls does not accept a ... argument. In the 
gnlsControl documentation it says

optimMethod: character - the optimization method to be used with the
          'optim' optimizer. The default is '"BFGS"'.  An alternative
          is '"L-BFGS-B"'.

but there is no obvious way to specify lower and upper. Either an
example if there is some scoping trick to do it would be nice,
or change that sentence to "optim method 'L-BFGS-B' will not work
since there is way to specify the upper and lower constraints"

Thanks

Nicholas


Nicholas

On Thu, 18 Oct 2007 15:46:01 +0100 (BST), "Prof Brian Ripley"
<ripley at stats.ox.ac.uk> said:
> On Thu, 18 Oct 2007, Nicholas Lewin-Koh wrote:
> 
> > Hi,
> > Following up on my own post, if in gnlsControl I specify
> > opt='optim' gnls exits quite nicely, with an error, which
> > is what I would expect. Is this a bug in nlminb?
> 
> Possibly, but complex algorithms can loop for non-bug reasons.  I don't 
> feel motivated to explore it in detail, but if you want/are able to, 
> please let us know what you find.
> 
> I have always found optim to work better in package nlme than nlminb (and 
> I know others who have the same experience).
> 
> >
> > Nicholas
> >
> >
> > tt<-gnls(response~SSllogis(conc,A,B,xmid,scal),tdat,start=start,weights=varPower(),verbose=TRUE,control=gnlsControl(opt='optim'))
> > **Iteration 1
> > GLS step: Objective: 29.04254varStruct  parameters:
> >    power
> > 0.3373206
> >
> > NLS step: RSS =  0
> > model parameters:-0.799941  8.99983  -0.522623  212.314
> > iterations: 2
> >
> > Convergence:
> >   params varStruct
> > 1.172208  1.000000
> > Error in optim(c(coef(gnlsSt)), function(gnlsPars) -logLik(gnlsSt,
> > gnlsPars),  :
> >  initial value in 'vmmin' is not finite
> > In addition: Warning messages:
> > 1: In log(xmid) : NaNs produced
> > 2: In log(xmid) : NaNs produced
> > 3: In log(xmid) : NaNs produced
> >
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
> 
> -- 
> 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



[Rd] nmle: gnls freezes on difficult case
Nicholas Lewin-Koh