UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

What's New in Stata 9: Mata

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

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


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