Hi,
I know that, if I directly use Mata's moptimize, I can use moptimize_init_userinfo and moptimize_util_userinfo to pass extra information to the evaluator programme. However, I prefer to use Stata's ml to call Mata's moptimize, so I would like to know whether there is any option in ml for doing that? Specifically, I need an extra dummy variable and a scalar to specify the log-likelihood function in the Mata evaluator programme.
I am also aware that ml's option group can pass an additional variable to the evaluator, and the variable will be treated as a cluster indicator in the calculation of robust errors. However, this is not a solution for me, because the extra variable I need is not a cluster indicator. Using ml's option group will seriously underestimate robust errors in my model.
A temporary solution found so far is specifying the dummy variable as an additional dependent variable in Stata's ml, and using it by moptimize_init_depvar in Mata. However, I don't really like this method, since it messed up the code a bit, and also the dummy variable is not really a dependent variable in the model. More importantly, this method cannot pass a scalar to the evaluator.
Overall, I would like to know whether there is any documented or undocumented option in Stata's ml for doing what moptimize_init_userinfo and moptimize_util_userinfo do in Mata.
(PS1. I consider this this question mainly as a question about Stata rather than Mata, so I post it here.)
(PS2. I am using Stata 14, but hope that my programmes can be backward compatible to at least Stata 11.)
Thank you very much.
Chi-lin
I know that, if I directly use Mata's moptimize, I can use moptimize_init_userinfo and moptimize_util_userinfo to pass extra information to the evaluator programme. However, I prefer to use Stata's ml to call Mata's moptimize, so I would like to know whether there is any option in ml for doing that? Specifically, I need an extra dummy variable and a scalar to specify the log-likelihood function in the Mata evaluator programme.
I am also aware that ml's option group can pass an additional variable to the evaluator, and the variable will be treated as a cluster indicator in the calculation of robust errors. However, this is not a solution for me, because the extra variable I need is not a cluster indicator. Using ml's option group will seriously underestimate robust errors in my model.
A temporary solution found so far is specifying the dummy variable as an additional dependent variable in Stata's ml, and using it by moptimize_init_depvar in Mata. However, I don't really like this method, since it messed up the code a bit, and also the dummy variable is not really a dependent variable in the model. More importantly, this method cannot pass a scalar to the evaluator.
Overall, I would like to know whether there is any documented or undocumented option in Stata's ml for doing what moptimize_init_userinfo and moptimize_util_userinfo do in Mata.
(PS1. I consider this this question mainly as a question about Stata rather than Mata, so I post it here.)
(PS2. I am using Stata 14, but hope that my programmes can be backward compatible to at least Stata 11.)
Thank you very much.
Chi-lin
Comment