[R] Estimates at each iteration of optim()?

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Mon Apr 23 17:51:26 CEST 2007


DEEPANKAR BASU wrote:
> I read the description of the trace control parameter in ?optim and then also looked at the examples given at the end. In one of the examples I found that they had used "trace=TRUE"  with the method "SANN". I am using the method "BFGS" and I tried using "trace=TRUE" too but I did not get the parameter estimates at each iteration. As you say, it might be method dependent. I tried reading the source code for "optim" but could not find out what I was looking for. Hence, I was wondering if anyone could tell me what option to use with the method "BFGS" to get the parameter estimates at each iteration of the optimization.
>
> Deepankar
>   

Well, ?optim has:

     The 'control' argument is a list that can supply any of the
     following components:

     'trace' Non-negative integer. If positive, tracing information on
          the progress of the optimization is produced. Higher values
          may produce more tracing information: for method '"L-BFGS-B"'
          there are six levels of tracing.  (To understand exactly what
          these do see the source code: higher levels give more
          detail.)

which I can only infer that you still haven't read...


>
> ----- Original Message -----
> From: Peter Dalgaard <p.dalgaard at biostat.ku.dk>
> Date: Monday, April 23, 2007 2:46 am
> Subject: Re: [R] Estimates at each iteration of optim()?
>
>   
>> DEEPANKAR BASU wrote:
>>     
>>> I am trying to maximise a complicated loglikelihood function with 
>>>       
>> the "optim" command. Is there some way to get to know the estiamtes 
>> at each iteration? When I put "control=list(trace=TRUE)" as an 
>> option in "optim", I just got the initial and final values of the 
>> loglikelihood, number of iterations and whether the routine has 
>> converged or not. I need to know the estimate values at each 
>> iteration.>
>>     
>>>   
>>>       
>> It might help if you actually _read_ the description of the trace 
>> control parameter (hint: it is not an on/off switch) in ?optim... 
>> And, 
>> as it says, this is method dependent, so you may have to study the 
>> source code.
>>
>>     
>>> Deepankar
>>>
>>> ______________________________________________
>>> 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.
>   


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list