Re: [R] Optimize function in R: unable to find maximum of logistic function

2013-10-28 Thread Shantanu MULLICK
Hello, Thanks a lot for the replies. I tried to use the "optim" function in R, and chose the "L-BFGS-B" method of optimization. Now the result is very sensitive to the starting values. I use the same function, but I give the line of code I use for "optim". optim(0.25, f, method= "L-BFGS-B", low

Re: [R] Optimize function in R: unable to find maximum of logistic function

2013-10-28 Thread William Dunlap
lap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of William Dunlap > Sent: Monday, October 28, 2013 3:03 PM > To: Rolf Turner; Shantanu MULLICK > Cc: r-help@r-project.org > Subject: Re: [R] O

Re: [R] Optimize function in R: unable to find maximum of logistic function

2013-10-28 Thread William Dunlap
, 2013 2:01 PM > To: Shantanu MULLICK > Cc: r-help@r-project.org > Subject: Re: [R] Optimize function in R: unable to find maximum of logistic > function > > > This could be described as a bug, perhaps. Or it could be described as > an indication that numerical optimization

Re: [R] Optimize function in R: unable to find maximum of logistic function

2013-10-28 Thread Rolf Turner
This could be described as a bug, perhaps. Or it could be described as an indication that numerical optimization is inevitably tricky. Notice that if you narrow down your search interval from [0,5] to [0,0.5] you get the right answer: > optimize(f, c(0, 0.5), maximum= TRUE,tol=1e-10) $maximum [

Re: [R] Optimize function in R: unable to find maximum of logistic function

2013-10-28 Thread Rui Barradas
Hello, This seems like a bug, removing 'maximum = TRUE' has no effect except that the returned value says it's a minimum, not a maximum. Rui Barradas Em 28-10-2013 17:00, Shantanu MULLICK escreveu: Hello Everyone, I want to perform a 1-D optimization by using the optimize() function. I want

[R] Optimize function in R: unable to find maximum of logistic function

2013-10-28 Thread Shantanu MULLICK
Hello Everyone, I want to perform a 1-D optimization by using the optimize() function. I want to find the maximum value of a "logistic" function. The optimize() function gives the wrong result. My code: f= function (k) { T_s = 20 result = (2- 2/(1+ exp(-2*T_s*k))) return(result) } optimize(f, c(0