Announcement

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

  • Help with PCA analysis

    Hello,

    I am trying to run a PCA on variables I used in my cluster analysis but keep receiving the following error code:

    . factor offershhaide2 offersmedsocial2 offersnurs2 offerspt2 offersot2 offersspeechpatho2 rn_cnt ratioallotherstaffpatient
    > ratiornpatient totalnumofservicesoffered
    (obs=4)
    note: offersnurs2 dropped because of zero variance
    (collinear variables specified)
    conformability error
    r(503);


    I have no idea why! I have included a few observations from my dataset below.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(offershhaide2 offersmedsocial2) byte offersnurs2 float(offerspt2 offersot2 offersspeechpatho2 rn_cnt ratioallotherstaffpatient ratiornpatient totalnumofservicesoffered) byte clus
    .9641132 .8040028 1 .9972395 .9199448 .8826777  4.51539 .0198233 .0175859 5.567978 1
    .9862069 .9282759 1 .9986207  .982069 .9565517   8.1728 .0525494 .0185362 5.851724 2
    .9121037 .7598463 1 .9726225 .9053794 .8117195  1.33184 .0159962 .0108745 5.361671 3
           1        1 1        1        1        1 2.543425 .0174332 .0142978        6 4
    end

  • #2
    Well, if Stata's output "(obs=4)" is to be believed (and I have never known it to get this kind of thing wrong), the "few observations from my dataset" are actually your entire data set. You are trying to do a factor analysis involving 10 variables and only 4 observations. It can't be done. Admittedly the "conformatbility error" message is a bit obscure here, and I'm not sure why that one popped up. But you need the number of observations to exceed the number of variables in the analysis. In fact, for the results to be of any use, they need to exceed by a fairly large multiple (opinions differ, but recommendations of 25 to 50 as the minimum number of observations per variable are readily found.)

    Comment


    • #3
      Clyde Schechter I am not sure why it says (obs=4). I have a little over 7,000 observations in my dataset.

      Comment


      • #4
        Well, since the command you showed (assuming it is actually the exact command that generated that output) has no -if- or -in- qualifiers there are two possibilities I can think of.

        1. Somewhere between when you opened that data set and when you gave the -factor- command you ran something that dropped all but four observations from your data set. You can check this possibility by running -count- right before the -factor- command and it will tell you how many observations there are.

        2. -factor-, like other Stata estimation commands, works only with observations that have no missing values on any of the variables mentioned in the command. It may be that there are enough missing values scattered around the data set that when you restrict to only those where none of the variables offershhaide2 offersmedsocial2 offersnurs2 offerspt2 offersot2 offersspeechpatho2 rn_cnt ratioallotherstaffpatient ratiornpatient totalnumofservicesoffered is missing, there are only four observations left. You can check this by running:
        Code:
        count if !missing(offershhaide2, offersmedsocial2, offersnurs2, offerspt2, offersot2, offersspeechpatho2, rn_cnt, ratioallotherstaffpatient, ratiornpatient, totalnumofservicesoffered)
        and Stata will tell you how many observations are complete enough to participate in the -factor- command.

        By the way, I should have mentioned this before, but -factor- and -pca- are different commands, different concepts, and they produce different results. If you want exploratory factor analysis, -factor- is appropriate. If you are looking for a principal components analysis, -pca- is the correct command.

        Comment


        • #5
          Clyde Schechter okay, I am thinking that number 2 is what is happening. I am dealing with home health agency data and its not the most complete.

          Comment

          Working...
          X