UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

What's New in Stata 9: Multivariate Statistics

Here is information about the Stata 9 Multivariate


/* ************************************************** */
/* factor analysis example -- from correlation matrix */
/*  five socio-economic variables from harman 1976    */

#delimit ;

matrix c = (
1.0,.00975,.97245,.43887,.02241\
00975,1.0,.15428,.69141,.86307\
97245,.15428,1.0,.51472,.12193\
43887,.69141,.51472,1.0,.77765\
02241,.86307,.12193,.77765,1.0);

#delimit cr

global names totpop medsch totemp prof medhou
matrix rownames c = $names
matrix colnames c = $names

matrix list c

pcamat c, n(172) components(2)

factormat c, n(172) pf blanks(.3) factors(2)

screeplot

rotate, varimax blanks(.3)

rotate, promax blanks(.3)

/* factor analysis postestimation commands */
estat structure
estat rotatecompare 
estat common
estat smc
estat kmo
estat residuals
loadingplot


/* ******************************************* */
/* simplistic multidimensional scaling example */

/* matrix of airline distances between 10 US cities */
#delimit ;

matrix d = (
0,587,1212,701,1936,604,748,2139,2182,543\
587,0,920,940,1745,1188,713,1858,1737,597\
1212,920,0,879,831,1726,1631,949,1021,1494\
701,940,879,0,1374,968,1420,1645,1891,1220\
1936,1745,831,1374,0,2339,2451,347,959,2300\
604,1188,1726,968,2339,0,1092,2594,2734,923\
748,713,1631,1420,2451,1092,0,2571,2408,205\
2139,1858,949,1645,347,2594,2571,0,678,2442\
2182,1737,1021,1891,959,2734,2408,678,0,2329\
543,597,1494,1220,2300,923,205,2442,2329,0);

#delimit cr

global names atl chi den hou la mi ny sf sea dc
matrix rownames d = $names
matrix colnames d = $names
matrix list d

mdsmat d, names($names)

/* redo graph with better aspectration and y-axis flipped */
mdsconfig, autoaspect ynegate


/* ******************************** */
/*  correspondence analysis example */

use http://www.gseis.ucla.edu/courses/data/hsb2, clear

tabulate prog ses, chi2

/* row profile */
tabulate prog ses, row nofreq

ca prog ses 

/* for ethnic */
cabiplot , nocolumn yline(0) xline(0)

/* for ses */
cabiplot , norow yline(0) xline(0)

/* combined */
cabiplot, yline(0) xline(0)



/* ******************************** */
/*  improved canonical correlation  */

use http://www.gseis.ucla.edu/courses/data/hsb2, clear

canon (read write socst)(math science female), test(1 2 3)

/* standardized canonical coefficients */
canon, stdcoef

/* canonical loadings */
estat loadings

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.