Skip to content
Prev 171514 / 398503 Next

Tracing gradient during optimization

Hi Shimrit,

Make sure that you set maximize=TRUE in the control settings (since you have
fnscale = -1 in your optim() call).  

A nice feature of spg() is that the entire code is in R, and can be readily
seen by just typing the function name at the R prompt.  On smaller problems
(with only a few parameters), it is usually slower than optim() or nlminb(),
since much of the computing is performed in C and/or Fortran.  But the
difference in speed is not that important in small problems, anyway.
However, it is faster on large-scale problems.  

Best,
Ravi.


----------------------------------------------------------------------------
-------

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvaradhan at jhmi.edu

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 

----------------------------------------------------------------------------
--------


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Shimrit Abraham
Sent: Tuesday, February 24, 2009 10:15 AM
To: Ravi Varadhan
Cc: r-help at r-project.org
Subject: Re: [R] Tracing gradient during optimization

Hi Ravi,

Thanks for your great suggestion, it does exactly what I need as it provides
more insight into what is going on in the 'black box'. In addition, it's
much faster than optim(). I will use this function in the future.

Kind Regards,

Shimrit
On Tue, Feb 24, 2009 at 2:33 PM, Ravi Varadhan <RVaradhan at jhmi.edu> wrote:

            
______________________________________________
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.