[R] Optim function

Rau, Roland Rau at demogr.mpg.de
Fri Nov 4 15:59:57 CET 2005


Hi,

is this what you meant?

myfun <- function(x) {
  return(x^2)
}

optim(par=0.5, fn=myfun, method="BFGS")$par 


Best,
Roland


> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of 
> jmbucci at stat.ucla.edu
> Sent: Friday, October 28, 2005 1:23 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Optim function
> 
> Hello,
> 
> Is there a general procedure when using the the optim 
> function("BFGS") to
> only output the converging value (i.e. final par value) 
> rather than all
> the other output?
> 
> Thank you.
> 
> ______________________________________________
> 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
> 

+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}




More information about the R-help mailing list