Announcement

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

  • r(503) Conformability Error when using -factor- (problem with code for -factor-?)

    Hello all,

    Has anyone else run across a conformability error r(503) when using -factor-? I am running version 14.2.

    I cannot share my dataset that I am working on (private information), but the gist is that I am running -factor- on a long list of variables.

    I have a theory of what is happening, and I believe it may be a problem with how -factor- is coded. But I would like to hear other's experiences/opinions.


    My theory is that -factor- is not working as intended after it drops a variable because of zero variance. Specifically, when I -set trace on- to see where the conformability error occurs, I see that it occurs when -factor- is trying to apply column names to the matrix.
    Code:
      - matrix colnames `Mean' = `varlist'
      = matrix colnames __00000F = q22_2 q22_3 q22_4 q22_6 q22_7 q22_8 q22_9 q22_10 q22_11 q22_12 q22_18 q22_19 q22_20 q22_21 q22_23 q22_27 q22_29 q22_33 q22_35 q22_36 q22_37 q22_39 q22_40 q22_43
    conformability error
    However, before this part of the program, -factor- outputs the following output:
    Code:
    note:  q22_39 dropped because of zero variance
    Yet q22_39 still appears in the varlist in the code that -matrix- code that errors out (see bold). Could it be that -factor- is not correctly dropping dropped var names from `varlist'?


    Thanks in advanced for the help.

    Roger

  • #2
    Your theory sounds good to me. I'm also able to replicate this error on my setup using the auto.dta data set:

    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . gen one = 1
    
    . factor weight length turn displacement
    (obs=74)
    
    Factor analysis/correlation                      Number of obs    =         74
        Method: principal factors                    Retained factors =          2
        Rotation: (unrotated)                        Number of params =          6
    
        --------------------------------------------------------------------------
             Factor  |   Eigenvalue   Difference        Proportion   Cumulative
        -------------+------------------------------------------------------------
            Factor1  |      3.44577      3.41411            1.0117       1.0117
            Factor2  |      0.03167      0.05594            0.0093       1.0210
            Factor3  |     -0.02427      0.02310           -0.0071       1.0139
            Factor4  |     -0.04737            .           -0.0139       1.0000
        --------------------------------------------------------------------------
        LR test: independent vs. saturated:  chi2(6)  =  381.70 Prob>chi2 = 0.0000
    
    Factor loadings (pattern matrix) and unique variances
    
        -------------------------------------------------
            Variable |  Factor1   Factor2 |   Uniqueness 
        -------------+--------------------+--------------
              weight |   0.9787    0.0391 |      0.0407  
              length |   0.9576   -0.0901 |      0.0748  
                turn |   0.8798   -0.0752 |      0.2203  
        displacement |   0.8926    0.1279 |      0.1868  
        -------------------------------------------------
    
    . factor weight length turn displacement one
    (obs=74)
    note:  one dropped because of zero variance
    conformability error
    And although I do not show it, with trace on the error occurs when Stata is trying to rename the columns of a matrix in just the way Roger describes.

    Roger, you should report this to Stata technical support.

    Comment


    • #3
      Thanks for the replication, Clyde! I'll report it to Stata.

      Comment


      • #4
        That's a plausible explanation of what is occurring. Have you tested it by excluding q22_39 from the list of variables supplied to factor - in other words, preempting factor's attempt to drop the variable by dropping it yourself?

        Crossed with Clyde's response, which went one better by recreating the error using a public dataset in a particularly nice way.

        Comment


        • #5
          William Lisowski -- Yes, I have. When I drop q22_39, all works fine.

          Comment


          • #6
            Received a response from StataCorp technical support. The problem has been reported to the developers.

            The current workaround to the problem is to check if a variable is constant and then manually exclude the constant variable from the -factor- command.

            Thanks again to Clyde and William for the help.

            Comment


            • #7
              Dear Roger and other Statalists,

              I have a encountered a similar problem when factor with Stata SE 14.0 with a long list of indicator variables. Some variables that were marked as dropped appear in the matrix exactly as in the output above. I now want to drop them manually but do not understand the criterion which Stata uses to drop them. I thought the criterion would be a standard deviation of zero but when I looked at one of these variables it had a mean of 0.12 with s.d. 0.32 with 0 missings. Does somebody know more about this? Thanks in advance!

              Best,
              Felix

              Comment


              • #8
                Unfortunately you do neither provide code nor output, but I guess you did something like

                Code:
                factor indicator_vars
                summarize problem_var
                and observed a standard deviation not equal to 0. Note that factor, as most other estimation commands, applies casewise deletion, so you need to look for the standard deviation in the estimation sample.

                Code:
                factor indicator_vars
                summarize problem_var if e(sample)
                I will not discuss the (in)appropriateness of factor analysis with indicator variables.

                Best
                Daniel

                Comment


                • #9
                  Dear Daniel,

                  ah yes, of course! Thank you for the quick help!

                  Best,
                  Felix

                  Comment

                  Working...
                  X