0
$\begingroup$

I am having little trouble figuring our which variables are the most important when I am using PCA . What I am trying to do is see which variables explain the most variance when it comes to stock prices . What I have done is I took data from some stocks in the pharmaceutical sector (like JNJ,MRK ect.)and I took their P/S P/B ROE AND other variables and I would like to know which variables explain the most variance so I know what metrics to look at when I am analyzing the pharmaceutical sector . This was the result.

Importance of components:
                          PC1    PC2    PC3    PC4     PC5     PC6     PC7     PC8    PC9    PC10      PC11
Standard deviation     2.7288 1.7861 1.5533 1.1306 0.82578 0.71937 0.47079 0.34490 0.3150 0.18236 1.814e-16
Proportion of Variance 0.4654 0.1994 0.1508 0.0799 0.04262 0.03234 0.01385 0.00743 0.0062 0.00208 0.000e+00
Cumulative Proportion  0.4654 0.6648 0.8156 0.8955 0.93809 0.97043 0.98429 0.99172 0.9979 1.00000 1.000e+00

so I decided to keep 5 principle components because they explain over 90% of the data

My problem is how do I determine which variables are most important from these 5 principle components ? Could I use something like a weighted average of each variable making the weight based off of the proportion of variance and take the variables with the highest weights average ? Or is there a better way of determining which of my variables are the most relevant from a PCA analysis

these are the eigenvectors

Rotation (n x k) = (16 x 11):
                                     PC1         PC2          PC3         PC4         PC5         PC6         PC7
Beta:M-3                     -0.29790642  0.06702808  0.043897343 -0.23444949  0.26922306 -0.52278907  0.49126902
Debt/Equity LF               -0.29683436 -0.20602790  0.209892052  0.17525538  0.17021916  0.22824284  0.13967642
P/S                          -0.13584463  0.37660138  0.371760998 -0.13147372  0.13251944  0.04785622 -0.07498348
P/B                          -0.32237181  0.04415421  0.294703959  0.01222229 -0.01493067  0.06389646  0.14404329
PM LF                         0.31231588  0.13244909  0.280519000 -0.04766506  0.01057485  0.13851709  0.10567161
OPM LF                        0.31383977  0.06628785  0.295610357 -0.05090070  0.03949326  0.20637913  0.07153909
R&D Exp T12M                  0.13290870 -0.22363789  0.356892802  0.17596955 -0.70388205 -0.08328041  0.23325195
ROA LF                        0.33128578  0.11822215  0.123556305 -0.15352214  0.15827191  0.04626632  0.41437205
ROE LF                        0.35240443  0.05558026  0.054402901 -0.00381858  0.09509125 -0.03775416  0.29445397
Rev - 1 Yr Gr:Q              -0.33213363  0.13173387  0.179946152 -0.04917693 -0.04327167  0.12309850  0.02891068
Dil EPS Frm Cont Op 1Y Gr LF -0.02935805  0.38139243  0.081834610  0.62033384  0.03574667 -0.03928716 -0.16499320
Curr Ratio LF                 0.02859583  0.48002784 -0.038108130 -0.37888227 -0.06938542  0.33198272 -0.18806338
P/E                           0.04731051  0.46627994 -0.033990479  0.41432037 -0.02392947 -0.30628066  0.12819470
Shrt Int Ratio:D-1           -0.33298583  0.01426119  0.008234069  0.10984204 -0.10586662  0.48387359  0.33537995
RSI: Period=14                0.06437034  0.09275629 -0.564351964  0.19383663  0.02711028  0.34214075  0.42631622
Tot Analyst Rec:D-1           0.15449771 -0.31749070  0.238832459  0.29221399  0.57364300  0.15502219 -0.09793154

hopefully you guys on stack exchange will share a little bit of your wisdom and help me out here . Thank you in advance .

$\endgroup$
2
$\begingroup$

IIRC, the signs of the PC are meaningless. +/-'ive doesn't itself tell you anything.

Rather, the cross-sectional, absolute max of the PCs will tell you which one is most important per item (eg: PC6 looks most important for Beta: M-3).

I think 6.6a and 6.6b in Cochrane's asset pricing touch on this (https://www.youtube.com/playlist?list=PLAXSVuGaw0KxVUym8IRkObSbUPEFaSbPt).

This blog post seems resonable: https://thequantmba.wordpress.com/2017/01/24/principal-component-analysis-of-equity-returns-in-python/

Generally, PC1, scaled to 100% weight, creates a long-short "Portfolio PC1".

These portfolios then tend to "look" like other observable assets.

Skimming this paper seems like it has some sample code, and was reviewed by someone: https://web.wpi.edu/Pubs/ETD/Available/etd-080614-144242/unrestricted/Chen,_Huanting_PCA_2014-07-31_FINAL_VERSION.pdf

The classic example is the level, slope and curvature exercise: https://faculty.chicagobooth.edu/john.cochrane/teaching/coursera_documents/bond_notes_2.pdf

You can likely recreate this with data on st louis fed's fred.

The larger question is "What are you trying to do?". PCA, IMO, is pretty confusing if you don't have a goal. PC1 is always the most important (in terms of variance explained) by default. That's just what PCA gives you.

| improve this answer | |
$\endgroup$
  • $\begingroup$ I am trying to see which variables wether it is price/sales ROE or Price/book explain the most variation in the data so I can know which metrics to look at when I am analyzing a sector $\endgroup$ – Pelumi Nov 5 '19 at 0:00
  • $\begingroup$ Wouldn't a regression solve your problem? You may just be using a less ideal statistical model for your specific problem $\endgroup$ – jason m Nov 5 '19 at 4:23
  • $\begingroup$ I know I know a regular multi linear regression model can help me out here I would just like like an improvement to the regular multi linear regression model . Would Lasso be a good idea here? $\endgroup$ – Pelumi Nov 5 '19 at 12:57
  • $\begingroup$ I would definitely recommend a lasso regression in this case, it seems odd to use a PCA and then step back to find which individual variables describe variability. You may also want to check out stepwise variable selection techniques. $\endgroup$ – jdpy19 Nov 6 '19 at 17:36
  • $\begingroup$ I acutally think random forest would be MUCH better than lasso. $\endgroup$ – jason m Nov 6 '19 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.