<>
Nicola said
My question is why I'm not getting the correct variance-covariance
matrix in the example below (simple linear regression) when using
optimize_result_V(S).
(snip)
From help mata optimize():
optimize_result_V_oim(), optimize_result_V_opg(),
optimize_result_V_robust()
real matrix optimize_result_V_oim(S)
real matrix optimize_result_V_opg(S)
real matrix optimize_result_V_robust(S)
These functions return the variance matrix of p evaluated at p
equal to optimize_result_param(). These functions are relevant only for
maximization of log-likelihood functions but may be called in any
context, including minimization.
Your Mata code does not maximize a log-likelihood function; it
maximizes the negative of the error sum of squares. If you wrote the
objective function as the log-likelihood function for a linear
regression, the variance matrix returned by these functions would
correspond to that of OLS regression.
Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/