
Dear all,

I'm optimizing a relatively simple function. Using optimize the optimized parameter value is worse than the starting.
why?

f<-function(delta,P,U){
    minimiz<-P+delta*U
    x<-minimiz[1]
    y<-minimiz[2]
    z<-100*(y-x^2)^2+(1-x)^2
    return(z)
}
  
result<-optimize(f, interval=c(-10, 10), P=c(0.99,1.01), U=c(1,0))
result

Output:

> result<-optimize(f, interval=c(-10, 10), P=c(0.99,1.01), U=c(1,0))
> result
$minimum
[1] -1.990015

$objective
[1] 4.01

Function Value at Starting Point with free parameter=0:

> f(0,c(0.99,1.01),c(1,0))
[1] 0.089501


It seems as if optimize doesn't check the whole interval.

> result<-optimize(f, interval=c(-1, 10), P=c(0.99,1.01), U=c(1,0))
> result
$minimum
[1] 0.01497394

$objective
[1] 2.481504e-05


Changing the lower interval value leads to the result I am looking for. How do I find this result when I have no idea where the optimal values lies and want to look in an interval that is as wide as possible?
any ideas?

Michael


 		 	   		  
	[[alternative HTML version deleted]]

