Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: polychoric matrix not positive definite


From   Stas Kolenikov <skolenik@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: polychoric matrix not positive definite
Date   Sat, 1 Dec 2012 10:58:34 -0600

I do not make any special effort to make the matrix positive definite.
The best advice I can give is to perform spectral decomposition on
r(R) and replace the eigenvalues with non-negative ones:

mata
rho = st_matrix("rho")
symeigensystem( rho, X, L )
Lplus = L
for(k=1;k<=cols(L);k++) {
  Lplus[1,k] = max( (Lplus[1,k], 0 ) )
}
rho_plus = X * diag( Lplus ) * X'
st_matrix( "rho_plus", rho_plus )
end
factormat rho_plus , ...

That's a cheat, but with 24 variables you should not expect much from
-polychoric-.

-- 
-- Stas Kolenikov, PhD, PStat (SSC)  ::  http://stas.kolenikov.name
-- Senior Survey Statistician, Abt SRBI  ::  work email kolenikovs at
srbi dot com
-- Opinions stated in this email are mine only, and do not reflect the
position of my employer



On Sat, Dec 1, 2012 at 9:39 AM, Nick Cox <njcoxstata@gmail.com> wrote:
> Please use full real names in posting to Statalist.
>
> Please explain where user-written programs you refer to come from.
>
> These are explicit requests in the FAQ that you were asked to read
> before posting.
>
> -polychoric- is from http://web.missouri.edu/~kolenikovs/stata
>
> Stas Kolenikov is the author and fully capable of speaking for himself, but
>
> 1. -polychoric- offers no such option that I can see.
>
> 2. This kind of problem may well indicate that your data are
> unsuitable for the purpose, so trying to force the issue may not be
> kind either to your data or to your project.
>
> Nick
>
> On Sat, Dec 1, 2012 at 2:39 PM, Tilahun <cherkos.z@gmail.com> wrote:
>
>> while attempting to perform factor analysis on ordered varaiable (with
>> three categories), I had to compute polychoric correlation but stata
>> returned the matrix is 'not positive definitive'. When computing
>> tetrachoric correlation on binary data, and option  - , posdef - fixes the
>> problem and let the correlation computed. Is there any similar option that
>> I can use. Please advise.
>>
>> The syntax are:
>>
>> The option - posdef - below fixes the problem matrix 'not positive
>> definitive'
>>
>> tetrachoric var1-var24, posdef
>> matrix rho = r(Rho)
>> factormat rho, pcf n(244)
>>
>> But the syntax below returns matrix 'not positive definitive' and the
>> option - posdef- is not allowed here
>>
>> polychoric var1-var24
>> matrix r=r(R)
>> factormat r, pcf n(244)
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index