|
|
|
||||
|
|
|||||
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
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