[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: re: Linear regression using Mata optimize

From   Christopher Baum <>
Subject   st: re: Linear regression using Mata optimize
Date   Tue, 10 Feb 2009 09:29:10 -0500

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).

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
An Introduction to Modern Econometrics Using Stata:

*   For searches and help try:

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index