Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <wuzhang50@yahoo.com>
To   STATA LIST <statalist@hsphsun2.harvard.edu>
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index