[R] optim for maximization

Ben Bolker bbolker at gmail.com
Mon Sep 29 00:31:31 CEST 2014


Padmanand Madhavan Nambiar <padmanandm <at> gmail.com> writes:

> 
> Hi Sir,
> 
>  How to use the "optim" for maximization. I don't understand the
>  control$fnscale option that is given on help page. It says if the
> control$fnscale is negative, the function will be maximized.
> 
>  Thanks a lot
> 
> Padmanand

  If 'fn' is your objective function and 'par' is your starting
parameter vector, just

   optim(par=par,fn=fn,control=list(fnscale=-1))



More information about the R-help mailing list