I have a black-box data generation routine, which depends on three parameters A,B,C.
I generate the data with this procedure for particular values A*, B*, and C*.
I then try to recover these parameters with Stata's optimizer starting from some A0, B0, and C0 and minimizing the sum of squared differences between the data points generated at each iteration and my benchmark.
After a lot of iterations Stata stops with:
Code:
numerical derivatives are approximate flat or discontinuous region encountered cannot compute an improvement -- flat region encountered r(430);
I want Stata not to fail, but return the last best values of parameters of what it considers to be the best guess for A,B, and C.
As I understand I should be using _optimize() in this case. The manual says literally:
optimize() returns an error code. If it is 0, optimization went well and you can obtain the parameter vector by using optimize_result_params(). If optimization did not go well, you can use the error code to diagnose what went wrong and take the appropriate action.
PS: of course I have tried varying the techniques and steps, with no obvious effect (in fact the default seemed to have worked the best).
Thank you, Sergiy Radyakin
0 Response to Optimization does not converge
Post a Comment