Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Polychoric matrix, factormat

    Hi all

    I'm hoping the community can help with an issue, in which I'm ultimately trying to run a factor analysis based on a polychoric correlation matrix. Here is the issue:

    I have a sample of 680 people on which I have 57 items which are a mix of binary and ordinal responses (100% complete data). I wish to conduct a factor analysis. I've used polychoric correlation to obtain the polychoric matrix but when I run factormat on this, I get issued the warning "the matrix is not positive (semi)definite".

    Following advice to another user on the old stata email list at this thread (see link at bottom), I tried Stan Kolenikov's suggestion to conduct a spectral decomposition of the matrix. To make this work I used his code, with a slight addition (see notes) to run:

    matrix r = r(R)
    matrix symeigen X L = r

    mata
    rho = st_matrix("r")
    X =st_matrix("X") /// Added by me to allow Stan's code to run
    L =st_matrix("L") /// Added by me to allow Stan's code to run
    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

    Stan then suggests running factormat on the new matrix, as follows

    factormat rho_plus_sym, n($N) factors(7)

    but this returns the error message (r505) that the matrix is no longer symmetrical. I've then tried adding

    makesymmetric(rho_plus)
    st_matrix( "rho_plus_sym", rho_plus )

    to the mata code above (immediately before the "end") and rerunning the factormat on rho_plus_sym, but the same error code (r505) is displayed. I've reached the very limit of my stata programming skills and statistical knowledge, so hope someone out there is able to help, either fixing this issue, or providing alternative suggestions for analysing the data. I'm an epidemiologist by background, not a statistician. Thanks very much for your time.

    James Kirkbride, UCL.

  • #2
    Skip the manual spectral decomposition, and try using polychoric matrix directly in factormat, but with its forcepsd option. Report back to the list if that doesn't work for you.

    Comment


    • #3
      Thanks very much. I'm not sure how I missed the forcepsd option, but that's done it. Many thanks. James

      Comment

      Working...
      X