[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: reg and matrix munipulation for OLS in Stata
I encountered a weird problem. As you know, the formal form of obtaining the coefficient estimates in OLS is: B = (X'X)^(-1)X'Y. In a dataset that contains X1, X2, X3, X4, X5 and Y, I did the following:
reg Y X1 X2 X3 X4 X5
mkmat X1 X2 X3 X4 X5, matrix(X_ALL)
matrix B = inv(X_ALL'*X_ALL)*X_ALL'Y
Theoretically, I am supposed to get the same results for the coefficient estimates contained in B matrix as well as in the results from reg command. However, my regression results are slightly different in these two approaches. Can anyone tell why I have different results?
Thank you very much!
Introducing the New Netscape Internet Service.
Only $9.95 a month -- Sign up today at http://isp.netscape.com/register
Netscape. Just the Net You Need.
New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp
* For searches and help try: