Additional to Maarten's suggestion you can use :
*------------------------------------
sysuse auto, clear
gen good = rep78>3
sum price, meanonly
gen expensive = price>r(mean)
tetrachoric foreign good expensive
matrix C = r(Rho)
local n = r(N)
factormat C, n(`n')
*--------------------------------------------
This way you don't have to type in the number of cases by hand - which
comes in handy when you're using loops for example....
Best,
Daniel
2006/11/14, Maarten buis <[email protected]>:
--- prneiva <[email protected]> wrote:
> I am trying to run a tetrachoric correlation in Stata 9. After
> running tetrachoric varlist, available, the correlation matrix is
> shown on the screen but it looks like that nothing is being saved
> on memory. Matrix list command shows that there is not any matrix
> in there.
>
> Stata's help says that the pairwise correlation matrix is returned
> as r(corr) and can be used to perform a factor or a principal
> component analysis of binary variables using factormat or pcamat. It
> also says tetrachoric saves the matrix r(Rho). What does it mean?
Pedro:
Here is an example on how you could use
-tetrachoric-, find the results that it
leaves behind, and use the correlation
matrix. Copy the example text, open
Stata, type -doedit-, and paste the text
and than click on do.
HTH,
Maarten
*------------ begin example -----------
sysuse auto, clear
/*make some binary vars*/
gen good = rep78>3
sum price, meanonly
gen expensive = price>r(mean)
tetrachoric foreign good expensive
/*see what -tetrachoric- leaves behind*/
return list
matrix list r(Rho)
/*do the factor analysis*/
factormat r(Rho), n(74)
*------------- end example ------------
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
___________________________________________________________
All New Yahoo! Mail – Tired of Vi@gr@! come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/