Im starting to learn how to use Mata "optimize"
For this, I'm trying to set a simple OLS estimator.
This raises a question. For an example like this, is it better to send to the evaluator the matrix of data itself (yy,xx),
or do you think is more efficient (memory and speed wise) to just send the pointer to those matrixes (as I did below)
Thank you
Code:
sysuse auto, clear mata: mata clear yy=st_data(.,"price") xx=st_data(.,"mpg foreign"),J(rows(yy),1,1) xy=(&yy,&xx) void myxb(todo, b, xy, ss, g, H) { ss= sum( ((*xy[1]):-(*xy[2])*b'):^2 ) } S = optimize_init() optimize_init_evaluator(S, &myxb()) optimize_init_which(S, "min") //optimize_init_evaluatortype(S, "d0") optimize_init_params(S, (1,1,1)) optimize_init_argument(S, 1, xy) p = optimize(S) end
0 Response to Problem with optimize: error 3201
Post a Comment