Here is information about Stata 9 Mata -- Matrix program
use http://www.ats.ucla.edu/stat/stata/notes3/hsb2, clear mata X = . st_view(X,.,("read","math","science")) meanx = mean(X, 1) meanx meanx' varx = variance(X, 1) varx corx = corr(varx) corx Y = . st_view(Y,.,("write")) meany = mean(Y, 1) xx = crossdev(X,meanx,X,meanx) xy = crossdev(X,meanx,Y,meany) b = invsym(xx)*xy b = b \ meany-meanx*b b end regress write read math science
The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.