[R] Optim

Spencer Graves spencer.graves at pdf.com
Fri May 11 01:17:17 CEST 2007


Hello, Wassim: 

GENERAL THEORY: 

      To expand on Ravi's comments, what can you tell us about the 
problem?  For example, if you have only 1 parameter, you can plot the 
log(likelihood) over a wide enough range so you can be confident you've 
covered all local maxima.  Then pick the max of the local maxima.  If 
there are only 2 parameters, you can make contour plots. 

      If this is not convenient, what else can you tell us about the 
problem?  For example, why are there local maxima?  If there are 
identifiability issues as Ravi suggested, what can you do to 
characterize and eliminate them -- using either constraints or 
transformations? 

      Also, can you find an upper bound with a unique maximum?  If yes, 
and if you've found one local maximum for your likelihood, you could (in 
theory at least) construct the set of all points where the upper bound 
is above the local max you have.   


PRAGMATICS IN R: 

      If you don't have time or knowledge to do something more 
sophisticated, you can try starting 'optim' at multiple places, store 
the answers and pick the winner. 

      Also, have you considered method = 'SANN'?  Simulated Annealing is 
designed specifically to produce something sensible with nasty 
problems.  It won't guarantee that you've found the optimal, but it 
might get you close. 

      For functions that are poorly conditioned, I've had reasonable 
luck using different methods, using the optimal found by one method as 
starting values for another method.  Also consider 'nlminb'. 

      hope this helps. 
      spencer graves

Ravi Varadhan wrote:
> Let us first assume that you have enumerated all the local maxima, which is
> by no means a trivial thing to assure.  How different are the likelihood
> values?  If they are significantly different, then take the parameter
> estimates corresponding to the largest likelihood.  If they are not
> "significantly" different but the corresponding parameter estimates differ
> widely, then you may have identifiability issues.  
>
> 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 stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Wassim Kamoum
> Sent: Thursday, May 10, 2007 3:46 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Optim
>
> Hello, 
>   I'm maximizing a likelihood function with the function "optim", but for
> different intial parameters (in the input of the optim funtion) , I found
> different value for the likelihood function and the parameters estimates,
> the causes is that the algorithm has not found the global maximum for the
> function but only a local maximum. What must I do to obtain the global
> maximum for the likelihood function?
>   Thanks
>
>  		
> ---------------------------------
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list