Announcement

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

  • variable factor mapping/ Factor Loading*plots

    Hello everyone!
    I am relatively new to PCA on stata. While i have managed to perform PCA quite easily on stata, while plotting my result I am facing a lot of problem.
    I have tried ''screenplot'' , ''eofplot'' but these give differnt results.
    I am looking for variable factor mapping/ Factor Loading plots (the one that has four axis and shows weights of different variables with lines).

    I know it can be done with R but need to know how to do it with STATA.

    really looking forward to suggestions please!



  • #2
    screeplot (which I think you mean here) has a completely different goal from eofplot (SSC).

    Sorry, but I have no familiarity with R functions in this territory, but I have used Stata from time to time. From your wording it seems to me that
    eofplot is what you want.

    Have you looked at
    loadingplot? If it is what you want, then the rest of the post is irrelevant.

    Here is an example of
    eofplot. If this doesn't help, perhaps you can refer to a published example from elsewhere.

    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . pca length weight displacement trunk headroom
    
    Principal components/correlation                 Number of obs    =         74
                                                     Number of comp.  =          5
                                                     Trace            =          5
        Rotation: (unrotated = principal)            Rho              =     1.0000
    
        --------------------------------------------------------------------------
           Component |   Eigenvalue   Difference         Proportion   Cumulative
        -------------+------------------------------------------------------------
               Comp1 |      3.76201        3.026             0.7524       0.7524
               Comp2 |      .736006      .427915             0.1472       0.8996
               Comp3 |      .308091      .155465             0.0616       0.9612
               Comp4 |      .152627      .111357             0.0305       0.9917
               Comp5 |     .0412693            .             0.0083       1.0000
        --------------------------------------------------------------------------
    
    Principal components (eigenvectors) 
    
        ------------------------------------------------------------------------------
            Variable |    Comp1     Comp2     Comp3     Comp4     Comp5 | Unexplained 
        -------------+--------------------------------------------------+-------------
              length |   0.4863   -0.2372   -0.1050   -0.5745   -0.6051 |           0 
              weight |   0.4842   -0.3329    0.0737   -0.2669    0.7603 |           0 
        displacement |   0.4610   -0.3390    0.3484    0.7065   -0.2279 |           0 
               trunk |   0.4334    0.3665   -0.7676    0.2914    0.0612 |           0 
            headroom |   0.3587    0.7640    0.5224   -0.1209    0.0130 |           0 
        ------------------------------------------------------------------------------
    
    . eofplot, legend(pos(3) col(1)) number mlabsize(medlarge ..) xsc(r(0.8 5.2)) yla(, ang(h)) yli(0, lc(gs12) lw(vthin))
    Code:
    
    


    eofplot doesn't itself try to optimize the order of variables, so some fooling around with that before you choose a plot can be a good idea.

    Click image for larger version

Name:	eofplot.png
Views:	1
Size:	45.3 KB
ID:	1602606

    Comment


    • #3
      Nick Cox thanks a lot for your response. I wasactually looking for loading plot but this post has been really helpful. I am absolutely new in the realm of PCA. I have some more questions please.
      1. in the first table the column for "Proportion'' adds up to almost 1 (0.88) so is that the ''loading''

      2.in the next table (principal components) how should I interpret the table? Is it column wise or row wise? and what does these components signify?

      your response will be really helpful.

      Comment


      • #4
        #1 No. It is the proportion of the total variance accounted for by each principal component.

        #2 There are several entire books on this method and chapters on it in many (perhaps most) multivariate statistics texts. Sorry, but I don't know a way to summarize easily what you might need to know. I'd start at the manual entry for pca and note its references. https://en.m.wikipedia.org/wiki/Prin...onent_analysis looks remarkably detailed and may be more than you want.

        Comment

        Working...
        X