This is of my dissertation. Huge headache! I am estimating this 20-parameter time-series model, minimizing this GMM objective function.
I was many times given the error message ’obj function returns complex values, fmincon or fminsearch cannot continue’. I know that fmincon/fminsearch these minimizers only handle real values, only real number can be minimized. My problem lies in a very complicated Square Root expression inside my obj function. The expression is so complex a function of those parameters that no way I could simply bound my parameters to guarantee the expression positive.
fmincon has the option to attach constraints, so I constrained that expression to be positive, but as many have pointed out here on Matlab forums, constraints in “fmincon algorithm” is not strictly obeyed. In my case, I still receive same error message after constrained. While fminsearch does not deal with constraints.
What are the solutions to this complex error? Bounds or constraints appear not working for it. Can one in some way tell the minimizer to skip/ignore this complex iteration and proceed to the next feasible iteration? Or is there a totally different solver that is free from complex issues? Gratefully appreciate any relevant feedback.