Goal

Examine how each asset contributes to portfolio standard deviation. This is to ensure that our risk is not concentrated in any one asset.

1 Import stock prices

I chose the stocks NVDA, AMD, INTC, QCOM, AVGO

2 Convert prices to returns (monthly)

3 Calculate Component Contribution to Portfolio Volatility

##                     AMD          AVGO         INTC         NVDA          QCOM
## 2013-01-31  0.080042631  0.1223714652  0.020163978  0.000000000  0.0650839899
## 2013-02-28 -0.043228694 -0.0442994033  0.003056165  0.038221501 -0.0057723746
## 2013-03-28  0.023810626  0.0537862527  0.044951843  0.013338704  0.0232962308
## 2013-04-30  0.100643521 -0.1168096548  0.092225001  0.070706283 -0.0831349011
## 2013-05-31  0.349557500  0.1659704105  0.023060424  0.054651943  0.0300630275
## 2013-06-28  0.019802609 -0.0034660355 -0.002061167 -0.030166786 -0.0328479303
## 2013-07-31 -0.079021973 -0.0189038525 -0.037422924  0.028091751  0.0552468611
## 2013-08-30 -0.142285017  0.0486861036 -0.050298554  0.026270009  0.0315537320
## 2013-09-30  0.152839195  0.1180135578  0.041877095  0.053460228  0.0155692872
## 2013-10-31 -0.131658393  0.0531138243  0.065437917 -0.024065798  0.0317252443
## 2013-11-29  0.086012929 -0.0155281635 -0.016765202  0.032034285  0.0619536357
## 2013-12-31  0.061270767  0.1720590945  0.085192084  0.026567023  0.0090649756
## 2014-01-31 -0.120694197  0.0327408977 -0.056252553 -0.020176938 -0.0004042975
## 2014-02-28  0.078471606  0.1215179133  0.018415894  0.162107437  0.0143139039
## 2014-03-31  0.077759411  0.0472522625  0.041532338 -0.025903793  0.0509860864
## 2014-04-30  0.019753709 -0.0142292515  0.033526834  0.030788555 -0.0019040575
## 2014-05-30 -0.022250646  0.1069814395  0.031886369  0.032886467  0.0218654836
## 2014-06-30  0.046406386  0.0237165118  0.123136860 -0.024508609 -0.0104249068
## 2014-07-31 -0.069163352 -0.0380392648  0.092363936 -0.057729841 -0.0717018650
## 2014-08-29  0.064378658  0.1682174080  0.036569631  0.110060512  0.0372907384
## 2014-09-30 -0.201203738  0.0617384592 -0.002867590 -0.052782884 -0.0176313221
## 2014-10-31 -0.197092916 -0.0086583408 -0.023537600  0.057399208  0.0488087834
## 2014-11-28 -0.003577818  0.0796412087  0.097533083  0.074852686 -0.0683085472
## 2014-12-31 -0.043963081  0.0777644593 -0.026109707 -0.044864132  0.0194262638
## 2015-01-30 -0.038172628  0.0225100869 -0.093823577 -0.043318833 -0.1739886658
## 2015-02-27  0.190716820  0.2154939149  0.013483094  0.142698864  0.1491980815
## 2015-03-31 -0.148805873 -0.0020793897 -0.061395669 -0.052582140 -0.0388932929
## 2015-04-30 -0.170452010 -0.0828817621  0.040118124  0.058908311 -0.0195144091
## 2015-05-29  0.008810621  0.2365369893  0.064227056  0.001460067  0.0244058224
## 2015-06-30  0.051293347 -0.1050412801 -0.124698761 -0.095717139 -0.0997565017
## 2015-07-31 -0.217948801 -0.0603898557 -0.049530329 -0.007988068  0.0277138899
## 2015-08-31 -0.064193162  0.0066111036 -0.005990677  0.123595536 -0.1209125049
## 2015-09-30 -0.051002506 -0.0045199967  0.054546819  0.092150816 -0.0516843500
## 2015-10-30  0.209091727 -0.0151532122  0.116380937  0.140555230  0.1006595285
## 2015-11-30  0.107245540  0.0577498343  0.033540560  0.115405619 -0.1872812275
## 2015-12-31  0.195650415  0.1098534829 -0.009246386  0.038347355  0.0242976234
## 2016-01-29 -0.265854608 -0.0820945616 -0.104876457 -0.118048624 -0.0976334588
## 2016-02-29 -0.027651504  0.0019426033 -0.038432667  0.071923486  0.1228522712
## 2016-03-31  0.286513083  0.1458839261  0.089177337  0.127655003  0.0068674059
## 2016-04-29  0.219628629 -0.0583009811 -0.066126334 -0.002810615 -0.0121976639
## 2016-05-31  0.252565652  0.0573944161  0.050953615  0.276388290  0.0930620847
## 2016-06-30  0.117539811  0.0098648850  0.037588132  0.006188223 -0.0248882056
## 2016-07-29  0.288654408  0.0414702278  0.060911641  0.194443982  0.1554565731
## 2016-08-31  0.075772552  0.0853946797  0.036670175  0.073468484  0.0162516673
## 2016-09-30 -0.068510397 -0.0193429322  0.050526666  0.110693725  0.0825885307
## 2016-10-31  0.045269423 -0.0130689979 -0.079358520  0.037805177  0.0032065663
## 2016-11-30  0.208935186  0.0012322874  0.002655828  0.260525200 -0.0008317762
## 2016-12-30  0.241162087  0.0418736815  0.044251151  0.146436063 -0.0439580373
## 2017-01-31 -0.089419301  0.1209648314  0.015049958  0.022601840 -0.1990868293
## 2017-02-28  0.332469208  0.0557118716 -0.009868346 -0.071875032  0.0648197733
## 2017-03-31  0.006204787  0.0418879117 -0.003597875  0.070843928  0.0151117171
## 2017-04-28 -0.089826957  0.0084132949  0.002215826 -0.043434415 -0.0648404007
## 2017-05-31 -0.172743565  0.0811673907  0.006304419  0.326022467  0.0734190528
## 2017-06-30  0.109106841 -0.0229672700 -0.067885596  0.001453601 -0.0364519191
## 2017-07-31  0.086677465  0.0567578294  0.050003102  0.117044943 -0.0374547829
## 2017-08-31 -0.045855434  0.0216958139 -0.003862273  0.042639651 -0.0064321271
## 2017-09-29 -0.019418086 -0.0344605445  0.082343046  0.053601045 -0.0082607617
## 2017-10-31 -0.148545524  0.0844415855  0.177803302  0.145700216 -0.0161402494
## 2017-11-30 -0.009140779  0.0517968398 -0.008483369 -0.029244614  0.2711716586
## 2017-12-29 -0.057644734 -0.0721113336  0.029013141 -0.036583830 -0.0355975657
## 2018-01-31  0.290111036 -0.0351369419  0.041999690  0.239241007  0.0639819972
## 2018-02-28 -0.126279741 -0.0063499529  0.030369204 -0.014959436 -0.0402437449
## 2018-03-29 -0.186458876 -0.0303055057  0.055060083 -0.043969132 -0.1596271188
## 2018-04-30  0.079353598 -0.0267932458 -0.008871938 -0.029312924 -0.0827385041
## 2018-05-31  0.232656934  0.0941523477  0.072808495  0.115145353  0.1408822638
## 2018-06-29  0.087800110 -0.0248068108 -0.104756681 -0.062544570 -0.0350176128
## 2018-07-31  0.201155761 -0.0899383355 -0.032924189  0.033048637  0.1327960069
## 2018-08-31  0.317113754 -0.0124320601  0.012900459  0.137075292  0.0696065551
## 2018-09-28  0.204779675  0.1265663361 -0.023820678  0.001210488  0.0562520615
## 2018-10-31 -0.528461644 -0.0989279937 -0.008707877 -0.287373635 -0.1356953880
## 2018-11-30  0.156736193  0.0604219607  0.056809732 -0.253667337 -0.0764713024
## 2018-12-31 -0.143100857  0.0791298948 -0.049470051 -0.202283020 -0.0126468970
## 2019-01-31  0.279386699  0.0534831069  0.004040478  0.073973887 -0.1390945642
## 2019-02-28 -0.036716646  0.0261601209  0.123157930  0.071593908  0.0752467891
## 2019-03-29  0.081186244  0.0969599467  0.013876159  0.151870034  0.0775146704
## 2019-04-30  0.079439632  0.0571623731 -0.050803304  0.007987653  0.4122806346
## 2019-05-31 -0.007994204 -0.2353092450 -0.141405891 -0.288680035 -0.2538553762
## 2019-06-28  0.102547402  0.1440166062  0.083390790  0.192591791  0.1387505527
## 2019-07-31  0.002630713  0.0073722299  0.054473874  0.026972522 -0.0390050475
## 2019-08-30  0.032312988 -0.0256723979 -0.057400747 -0.006208219  0.0611068015
## 2019-09-30 -0.081448072 -0.0143598345  0.083330817  0.038414355 -0.0114372424
## 2019-10-31  0.157348653  0.0590061658  0.092607471  0.143946839  0.0531010666
## 2019-11-29  0.143100874  0.0767459323  0.032021818  0.076031689  0.0379340925
## 2019-12-31  0.158192829  0.0094771248  0.030536712  0.082163066  0.0622254907
## 2020-01-31  0.024554311 -0.0349689801  0.065947292  0.004790612 -0.0336550538
## 2020-02-28 -0.032874943 -0.1127575142 -0.136132734  0.133627316 -0.0857444145
## 2020-03-31  0.000000000 -0.1227417826 -0.025539560 -0.024248478 -0.1382768338
## 2020-04-30  0.141443063  0.1359220010  0.102807385  0.103279380  0.1509147321
## 2020-05-29  0.026557731  0.0698466088  0.053644600  0.194461882  0.0277044506
## 2020-06-30 -0.022367226  0.0905063808 -0.050515860  0.068216491  0.1279082409
## 2020-07-31  0.386468079  0.0036055022 -0.225946899  0.111189562  0.1465882923
## 2020-08-31  0.159505216  0.0916441182  0.072053062  0.231105530  0.1202103574
## 2020-09-30 -0.102282260  0.0573513188  0.016159047  0.011895567 -0.0066526427
## 2020-10-30 -0.085249927 -0.0411573597 -0.156470840 -0.076501290  0.0471380192
## 2020-11-30  0.207589583  0.1385315744  0.095180491  0.066921438  0.1764812282
## 2020-12-31 -0.010305505  0.0949541052  0.029950230 -0.025899910  0.0388330270
## 2021-01-29 -0.068478958  0.0284817336  0.108146710 -0.005010726  0.0255345005
## 2021-02-26 -0.013282561  0.0420978649  0.096749264  0.054293189 -0.1375985062
## 2021-03-31 -0.073771271 -0.0055179939  0.051622291 -0.026723382 -0.0220345729
## 2021-04-30  0.038975739 -0.0162203862 -0.106576618  0.117297970  0.0457721776
## 2021-05-28 -0.019048206  0.0347465551 -0.001012068  0.079071273 -0.0311725762
## 2021-06-30  0.159523669  0.0173004373 -0.017305753  0.208332079  0.0655836961
## 2021-07-30  0.122680138  0.0177923388 -0.044063118 -0.025494216  0.0469457962
## 2021-08-31  0.041774537  0.0240393641  0.012786467  0.138204162 -0.0209792901
## 2021-09-30 -0.073246845 -0.0177059867 -0.014533552 -0.077484784 -0.1240180697
## 2021-10-29  0.155648945  0.0920184038 -0.083740829  0.210396017  0.0309925420
## 2021-11-30  0.275527434  0.0405637895  0.011003653  0.245338733  0.3054132371
## 2021-12-31 -0.095815465  0.1901932345  0.045688066 -0.105149888  0.0164854016
## 2022-01-31 -0.230729542 -0.1272886112 -0.053441850 -0.183267031 -0.0396559687
## 2022-02-28  0.076555710  0.0026592016 -0.015619696 -0.004133520 -0.0216828737
## 2022-03-31 -0.120482480  0.0761771239  0.038252557  0.112575984 -0.1140126954
## 2022-04-29 -0.245712033 -0.1273434255 -0.128356434 -0.386065759 -0.0898352475
## 2022-05-31  0.174849100  0.0453838996  0.026735898  0.006717017  0.0249562515
## 2022-06-30 -0.286700804 -0.1691783396 -0.171751920 -0.208219156 -0.1091344596
## 2022-07-29  0.211383814  0.0973459606 -0.029844624  0.180792142  0.1271504503
## 2022-08-31 -0.107161630 -0.0703371327 -0.118815707 -0.185089406 -0.0867066540
## 2022-09-30 -0.292287949 -0.1086290426 -0.214021872 -0.217576600 -0.1576342774
## 2022-10-31 -0.053488672  0.0571406683  0.098233983  0.106044057  0.0405882369
## 2022-11-30  0.256609830  0.1588014844  0.069498764  0.226461877  0.0787198021
## 2022-12-30 -0.181111434  0.0229016950 -0.129028281 -0.146693652 -0.1402284841
## 2023-01-31  0.148643655  0.0452470530  0.066947614  0.290330166  0.1919921060
## 2023-02-28  0.044631101  0.0157384601 -0.113264229  0.172531518 -0.0754428507
## 2023-03-31  0.220952299  0.0836757896  0.270385294  0.179536463  0.0383494719
## 2023-04-28 -0.092284450 -0.0237227003 -0.050536389 -0.001008489 -0.0882804349
## 2023-05-31  0.279677610  0.2543637437  0.016246811  0.310008168 -0.0225331714
## 2023-06-30 -0.037054001  0.0763357547  0.061671827  0.111729823  0.0484499159
## 2023-07-31  0.004292397  0.0353588012  0.067356828  0.099530648  0.1046295093
## 2023-08-31 -0.078906991  0.0266163542 -0.014178264  0.054674122 -0.1361963560
## 2023-09-29 -0.027814218 -0.0999543117  0.011600071 -0.126218761 -0.0307660872
## 2023-10-31 -0.042923335  0.0129073788  0.026371980 -0.064546214 -0.0188145204
## 2023-11-30  0.207055468  0.0955511258  0.205944141  0.137050323  0.1752835351
## 2023-12-29  0.196105829  0.1917352680  0.117037006  0.057262875  0.1139788866
## 2024-01-31  0.128899206  0.0555394007 -0.153951666  0.217059118  0.0264734568
## 2024-02-29  0.138134928  0.0972266814  0.002230210  0.251388415  0.0656793114
## 2024-03-28 -0.064576574  0.0232303529  0.025683568  0.132939745  0.0704072138
## 2024-04-30 -0.130678165 -0.0191497126 -0.371303188 -0.044746403 -0.0205883898
## 2024-05-31  0.052397554  0.0215160664  0.016447718  0.238127472  0.2113709798
## 2024-06-28 -0.028502961  0.1925360925  0.003882183  0.119508719 -0.0241562072
## 2024-07-31 -0.115750773  0.0007906828 -0.007454249 -0.054220233 -0.0959882028
## 2024-08-30  0.027847841  0.0132306216 -0.326382133  0.019883146 -0.0317218954
## 2024-09-30  0.099365224  0.0610355701  0.062437778  0.017277928 -0.0252517406
## 2024-10-31 -0.130054782 -0.0159526937 -0.086314048  0.089122631 -0.0437543779
## 2024-11-29 -0.049005465 -0.0463545380  0.111152208  0.040520710 -0.0263943246
## 2024-12-31 -0.127240370  0.3606331958 -0.181905849 -0.028993106 -0.0262443752
## 2025-01-31 -0.040894471 -0.0466637674 -0.031410837 -0.111926736  0.1184047709
## 2025-02-28 -0.149389826 -0.1039204207  0.199921772  0.039598579 -0.0955588365
## 2025-03-31  0.028432293 -0.1718766200 -0.043934735 -0.141937962 -0.0175334879
## 2025-04-30 -0.053888788  0.1393750503 -0.122085482  0.004970099 -0.0341012963
## 2025-05-30  0.128782120  0.2292866468 -0.027744587  0.215623673 -0.0222035747
## 2025-06-30  0.248027705  0.1322559258  0.136085694  0.156363856  0.0984150406
## 2025-07-31  0.217121254  0.0634269180 -0.123379043  0.118521186 -0.0817395510
## 2025-08-29 -0.080766083  0.0124855590  0.206849966 -0.020963769  0.0909274244
## 2025-09-30 -0.005178555  0.1054873450  0.320504975  0.068827324  0.0401029311
## 2025-10-31  0.459346909  0.1136826174  0.175592624  0.081830418  0.0837902401
## 2025-11-21 -0.228605091 -0.0829688027 -0.147670141 -0.123975312 -0.1023553400
##              AMD        AVGO        INTC        NVDA        QCOM
## AMD  0.024257654 0.005227885 0.003571724 0.010406740 0.006640726
## AVGO 0.005227885 0.007718960 0.002395783 0.004908713 0.002931625
## INTC 0.003571724 0.002395783 0.009137458 0.003786168 0.002205372
## NVDA 0.010406740 0.004908713 0.003786168 0.014694214 0.005222503
## QCOM 0.006640726 0.002931625 0.002205372 0.005222503 0.009235837
##            [,1]
## [1,] 0.08309375
##             AMD       AVGO       INTC       NVDA        QCOM
## [1,] 0.03258714 0.01501549 0.01034287 0.01936894 0.005779311
## [1] 0.08309375
## # A tibble: 1 × 5
##     AMD  AVGO  INTC  NVDA  QCOM
##   <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0.392 0.181 0.124 0.233  0.07
## # A tibble: 5 × 2
##   asset contribution
##   <chr>        <dbl>
## 1 AMD          0.392
## 2 AVGO         0.181
## 3 INTC         0.124
## 4 NVDA         0.233
## 5 QCOM         0.07
## # A tibble: 1 × 5
##     AMD  AVGO  INTC  NVDA  QCOM
##   <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0.392 0.181 0.124 0.233  0.07

6 Plot: Colum Chart of Component Contribution and Weight

Which of the assets in your portfolio the largest contributor to the portfolio volatility? Do you think your portfolio risk is concentrated in any one asset?

From the bar chart, AMD is the largest contributor to portfolio volatility (Around 39-40% of the total risk).

On concentration, yes, risk is somewhat concentrated in AMD, because it contributes way more than any other single holding. That said, it is not only AMD. NVDA is also a meaningful chunk (around 23%), and AVGO is moderate (around 18%). INTC and QCOM are relatively small contributors.