I would like to find the 4-dimensional vector that minimises some function f which depends on 4 variables. The first three variables take on strictly positive values; the fourth one is unconstrained. To do this, I would like to use R. I have tried to apply the nlminb function with lower=c(0.001, 0.001, 0.001, -Inf) as one of its optional argument. The procedure does converge but it turns out that the proposed solution does not satisfy the constraint ! I have an alternative solution that consists of using an exponential transformation. However, I would apprecia开发者_StackOverflow中文版te to figure out why R returns a solution that does not meet my requirements.
Any comment will be appreciated, Thanks, Marco
It would be very difficult for me to provide that function here. The reason is that it depends on a number of pre-defined stuff. Anyway, I am not sure to understand why this occurs but I have realized that my function sometimes returns NaN due to very very large numbers. Actually, I have some doubt about convergence. On the other hand, I have made some modifications and the alternative solution seems to work well. As a conclusion, I think that the problem came from my function, not from nlminb.
Best, Marco
精彩评论