Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: factor analysis on tetrachoric correlation


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: factor analysis on tetrachoric correlation
Date   Mon, 26 Jan 2004 12:29:57 +0900

Couldn't you get at least a reasonable estimate of the polychoric
correlation coefficient from -reoprob- (and the corresponding tetrachoric
correlation from -xtprobit-)?  I'm not sure what the theoretical
relationship is between the expected value of rho reported by these commands
and the correlation coefficient of the underlying latent variable.  They're
not synonymous, perhaps, but in the simulation below, using a simple case
for convenience (same number of categories--4--for both variables), rho
seems to be a suitable estimate of the correlation coefficient of the
underlying latent variable (the polychoric correlation coefficient).

Joseph Coveney


Mike Lacy wrote:

>It would be nice if someone could do a Stata package for polychoric
>correlations, which of course would include the tetrachoric case. The
>tetrac package, by its own admission, is not very accurate. There are some
>implementations out there (SPSS, Pascal, Fortran) that could be translated,
>with authors' permissions, of course.

----------------------------------------------------------------------------

clear
set more off
set seed 20040126
*
program define corho, rclass
    version 8.2
    tempvar dep rec ind cat
    tempname cor A
    drop _all
    set obs 40
    generate float `dep'1 = invnorm(uniform())
    scalar `cor' = 0.4 + 0.4 * uniform()
    generate float `dep'0 = `cor' * `dep'1 + ///
      sqrt(1 - `cor' * `cor') * invnorm(uniform())
    correlate `dep'*
    return scalar cor = r(rho)
    generate byte `rec' = _n
    quietly reshape long `dep', i(`rec') j(`ind')
    generate byte `cat' = 0
    forvalues i = 1/3 {
        replace `cat' = `cat' + (`dep' >= invnorm(`i' / 3))
    }
    capture reoprob `cat' `ind', i(`rec')
    matrix `A' = e(b)
    return scalar rho = `A'[1,4]
end
*
simulate "corho" cor = r(cor) rho = r(rho), reps(20)
regress rho cor
predict rho_hat, xb
/* predict rho_res, residuals
graph7 rho_res rho_hat, xlabel ylabel yline(0) */
graph7 rho rho_hat cor cor, xlabel ylabel sort ///
  connect(.LL) symbol(Oii)
exit



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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index