# Re: [R] optimization problem

From: John C Nash <nashjc_at_uottawa.ca>
Date: Fri, 28 Nov 2008 11:28:29 -0500

Users should be aware that optim() does local optimization. The default Nelder-Mead approach is fairly robust at finding such a local minimum, though it may halt if it is on a flat area of the loss function surface. I would recommend trying one of the BFGS codes (they use somewhat different approaches) and look at the gradient information. With only 3 parameters, these should work fine. There is also another package (I forget the name -- someone?) that does full Newton with Hessian computed. That may be worth using to get more complete information about your problem.

tedzxx: If you send me the data off-list (maybe also include the function again to save me digging it up again), I'll try to provide more information.

John Nash

I am facing an optimization problem. I am using the function optim(par,fun),   but I find that every time I give different original guess parameter, I can   get different result. For example
I have a data frame named data:

price s x t

```  1 1678.0 12817 11200 0.1495902
2 1675.5 12817 11200 0.1495902
3 1678.0 12817 11200 0.1495902
4 1688.0 12817 11200 0.1495902
5 1677.0 12817 11200 0.1495902
6 1678.5 12817 11200 0.1495902
```

??.
f<-function(p,...){
```	v=exp(p[1]+p[2]*(x/s)+p[3]*(x/s)2)
d1=(log(s/x)+(v2)*t/2)/(v*sqrt(t))
d2=(log(s/x)-(v2)*t/2)/(v*sqrt(t))
sum((price-(s*pnorm(d1)-x*pnorm(d2)))2)
```
}
p=c(-0.1,-0.1,0.01)
optim(par=p,f) # use the default algorism

I have other different original estimes, It also show me different result.

Why?

Thanks.

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. Received on Fri 28 Nov 2008 - 16:31:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 28 Nov 2008 - 17:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.