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

  • Factor analysis using custom correlation matrix


    I'm stuck!
    I'm running a factor analysis using a polychoric correlation matrix. Everything is ok, but I cant compute scores by using predict function in the postestimation menu since I did not use the raw data. I was wondering how can I compute the scores in this case.

    Thanks & Regards.

  • #2
    So you're doing factor analysis using the factormat command, presumably.

    After running factormat, before running the predict command you can use the dataset containing the data for which you want to calculate scores.
    . describe
    Contains data
      obs:             0                          
     vars:             0                          
    Sorted by: 
    . matrix list corr
    symmetric corr[2,2]
               weight     length
    weight          1
    length  .94600864          1
    . display `nobs'
    . factormat corr, n(`nobs')
    Factor analysis/correlation                      Number of obs    =         74
        Method: principal factors                    Retained factors =          1
        Rotation: (unrotated)                        Number of params =          1
             Factor  |   Eigenvalue   Difference        Proportion   Cumulative
            Factor1  |      1.84094      1.89202            1.0285       1.0285
            Factor2  |     -0.05108            .           -0.0285       1.0000
        LR test: independent vs. saturated:  chi2(1)  =  163.35 Prob>chi2 = 0.0000
    Factor loadings (pattern matrix) and unique variances
            Variable |  Factor1 |   Uniqueness 
              weight |   0.9594 |      0.0795  
              length |   0.9594 |      0.0795  
    . sysuse auto
    (1978 Automobile Data)
    . predict fac1
    (option regression assumed; regression scoring)
    Scoring coefficients (method = regression)
            Variable |  Factor1 
              weight |  0.49302 
              length |  0.49302 
    (variable means assumed 0; use means() option of factormat for nonzero means)
    (variable std. deviations assumed 1; use sds() option of factormat to change)


    • #3
      Hello! I couldnt get the scores. A new column vector appears, but it only has NA's.

      use, clear
      polychoric facsex facnat facrank studrank grade salary yrsut nstud
      global N = r(sum_w)
      matrix r = r(R)
      factormat r, n($N) factors(3)
      predict fac1
      Click image for larger version

Name:	asd.jpg
Views:	1
Size:	44.5 KB
ID:	1512150
      Last edited by NIP NIP; 13 Aug 2019, 22:59.


      • #4
        Originally posted by NIP NIP View Post
        A new column vector appears, but it only has NA's.
        No, the new variable doesn't contain only missing values.

        count if !mi(studrank, yrsut)
        count if !mi(fac1)

        You might want to give the FAQ a quick read, too, while you're at it.

        Focus on (1) what to include when initially describing your problem, (2) how to refer to user-written commands, (3) how to avoid using image files to show data excerpts and output, and (4) how to refer to yourself.


        • #5
          How can I see the scores? Is it possible? Thanks.


          • #6
            You sent a screen shot of your data. Scroll down in the window you took your screen shot of and you will eventually see observations where the scores are not missing.

            As Joseph Coveney pointed out in post #4, you have 90 observations with missing values for either studrank or yrsut, and thus a factor score - which includes studrank and uyrsut - cannot be computed for these 90 observations, so those factor scores are missing values.
            . count if !mi(studrank, yrsut)
            . count if !mi(fac1)
            . count if mi(studrank, yrsut)
            . count if mi(fac1)
            Last edited by William Lisowski; 14 Aug 2019, 11:11.


            • #7
              Thanks for your time to both of you!