Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: matrix operations in STATA and MATA do not match!


From   Wu Zhang <[email protected]>
To   STATA LIST <[email protected]>
Subject   st: matrix operations in STATA and MATA do not match!
Date   Fri, 5 Apr 2013 00:54:55 -0700 (PDT)

Hi folks,

   I am trying to calculate the ordinary least square by matrix; the formula is beta_hat=(X'*X)^(-1)*X'*Y

In STATA, I run the code:  matrix beta_hat= syminv(X'*X)*X'*Y

In MATA, I run the code: beta_hat= luinv(X'*X)*X'*Y

Interestingly,  all the estimates of parameters of Xs are exactly the same while the estimates for the constant are different. Could you guys explain how it happens?

Thank you very much!

Wu 


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index