covEstimation: Covariance matrix estimation

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/covEstimation.R

Description

Function which performs various estimations of covariance matrices.

Usage

1
covEstimation(rets, control = list())

Arguments

rets

a matrix (T x N) of returns.

control

control parameters (see *Details*).

Details

The argument control is a list that can supply any of the following components:

Value

A (N x N) covariance matrix.

Note

Part of the code is adapted from the Matlab code by Ledoit and Wolf (2014).

Author(s)

David Ardia, Kris Boudt and Jean-Philippe Gagnon Fleury.

References

Jorion, P. (1986). Bayes-Stein estimation for portfolio analysis. Journal of Financial and Quantitative Analysis 21(3), pp.279-292.

Harman, H.H. (1976) Modern Factor Analysis. 3rd Ed. Chicago: University of Chicago Press.

Ledoit, O., Wolf, M. (2002). Improved estimation of the covariance matrix of stock returns with an application to portfolio selection. Journal of Empirical Finance 10(5), pp.603-621.

Ledoit, O., Wolf, M. (2003). Honey, I Shrunk the Sample Covariance Matrix. Journal of Portfolio Management 30(4), pp.110-119.

Ledoit, O., Wolf, M. (2004). A well-conditioned estimator for large-dimensional covariance matrices. Journal of Multivariate Analysis 88(2), pp.365-411.

RiskMetrics (1996) RiskMetrics Technical Document. J. P. Morgan/Reuters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Load returns of assets or portfolios
data("Industry_10")
rets = Industry_10

# Naive covariance estimation
covEstimation(rets)

# Ewma estimation of the covariance with default lambda = 0.94
covEstimation(rets, control = list(type = 'ewma'))

# Ewma estimation of the covariance with default lambda = 0.90
covEstimation(rets, control = list(type = 'ewma', lambda = 0.9))

# Factor estimation of the covariance with dafault K = 1
covEstimation(rets, control = list(type = 'factor'))

# Factor estimation of the covariance with K = 3
covEstimation(rets, control = list(type = 'factor', K = 3))

# Ledot-Wolf's estimation of the covariance
covEstimation(rets, control = list(type = 'lw'))

# Shrinkage of the covariance matrix using constant correlation matrix
covEstimation(rets, control = list(type = 'const'))

# Shrinkage of the covariance matrix towards constant correlation matrix by
# Ledoit-Wolf.
covEstimation(rets, control = list(type = 'cor'))

# Shrinkage of the covariance matrix towards one-parameter matrix
covEstimation(rets, control = list(type = 'oneparm'))

# Shrinkage of the covaraince matrix towards diagonal matrix
covEstimation(rets, control = list(type = 'diag'))

# Shrinkage of the covariance matrix for large data set
covEstimation(rets, control = list(type = 'large'))

Example output

          NoDur     Durbl     Manuf     Enrgy     HiTec     Telcm     Shops
NoDur 0.4122099 0.4550264 0.3970799 0.3824494 0.4073395 0.3512599 0.3701115
Durbl 0.4550264 1.1292672 0.7137938 0.7846488 0.7710404 0.5808400 0.6207365
Manuf 0.3970799 0.7137938 0.6168984 0.6932033 0.6021570 0.4702709 0.4691876
Enrgy 0.3824494 0.7846488 0.6932033 1.5292486 0.5973311 0.4644982 0.4220034
HiTec 0.4073395 0.7710404 0.6021570 0.5973311 0.7909029 0.5367300 0.5301960
Telcm 0.3512599 0.5808400 0.4702709 0.4644982 0.5367300 0.5865656 0.4267567
Shops 0.3701115 0.6207365 0.4691876 0.4220034 0.5301960 0.4267567 0.5466088
Hlth  0.4135080 0.6898250 0.5560005 0.5314481 0.6685694 0.4862383 0.4978371
Utils 0.2861266 0.3323168 0.3279463 0.4765286 0.2976034 0.2870761 0.2513963
Other 0.4111210 0.7286040 0.5949195 0.5980933 0.6379035 0.4978215 0.5149505
           Hlth     Utils     Other
NoDur 0.4135080 0.2861266 0.4111210
Durbl 0.6898250 0.3323168 0.7286040
Manuf 0.5560005 0.3279463 0.5949195
Enrgy 0.5314481 0.4765286 0.5980933
HiTec 0.6685694 0.2976034 0.6379035
Telcm 0.4862383 0.2870761 0.4978215
Shops 0.4978371 0.2513963 0.5149505
Hlth  0.9527097 0.3300487 0.6127343
Utils 0.3300487 0.6251451 0.2915933
Other 0.6127343 0.2915933 0.6771916
          NoDur     Durbl     Manuf     Enrgy     HiTec     Telcm     Shops
NoDur 0.6884264 0.6968614 0.6253347 0.6292797 0.7429935 0.5937213 0.5139155
Durbl 0.6968614 1.2859647 0.8770188 1.3851989 0.9801903 0.6996367 0.6943329
Manuf 0.6253347 0.8770188 0.8325074 1.2760119 0.8302048 0.5920221 0.4918145
Enrgy 0.6292797 1.3851989 1.2760119 3.8604875 1.0183651 0.6852690 0.4842238
HiTec 0.7429935 0.9801903 0.8302048 1.0183651 1.0693693 0.7090170 0.6355286
Telcm 0.5937213 0.6996367 0.5920221 0.6852690 0.7090170 0.7077079 0.4905019
Shops 0.5139155 0.6943329 0.4918145 0.4842238 0.6355286 0.4905019 0.5790688
Hlth  0.5590460 0.7270964 0.6028956 0.6682271 0.7783897 0.5467859 0.3972613
Utils 0.6841352 0.8143582 0.7446294 1.0963180 0.7842275 0.6378874 0.5025269
Other 0.6783463 0.8849484 0.7694916 1.0016407 0.8495507 0.6304318 0.5633044
           Hlth     Utils     Other
NoDur 0.5590460 0.6841352 0.6783463
Durbl 0.7270964 0.8143582 0.8849484
Manuf 0.6028956 0.7446294 0.7694916
Enrgy 0.6682271 1.0963180 1.0016407
HiTec 0.7783897 0.7842275 0.8495507
Telcm 0.5467859 0.6378874 0.6304318
Shops 0.3972613 0.5025269 0.5633044
Hlth  1.4395031 0.8227125 0.7215047
Utils 0.8227125 1.3274624 0.7274502
Other 0.7215047 0.7274502 0.8473433
          NoDur     Durbl     Manuf     Enrgy     HiTec     Telcm     Shops
NoDur 0.7619580 0.7327540 0.6888983 0.7135625 0.8361137 0.6535134 0.5407678
Durbl 0.7327540 1.1751153 0.8334705 1.3261624 0.9533871 0.7118150 0.6805423
Manuf 0.6888983 0.8334705 0.8145140 1.1982308 0.8507341 0.6297142 0.4924125
Enrgy 0.7135625 1.3261624 1.1982308 3.4503028 1.0099593 0.7613762 0.5222208
HiTec 0.8361137 0.9533871 0.8507341 1.0099593 1.1091373 0.7509124 0.6389630
Telcm 0.6535134 0.7118150 0.6297142 0.7613762 0.7509124 0.7024603 0.4993395
Shops 0.5407678 0.6805423 0.4924125 0.5222208 0.6389630 0.4993395 0.5565039
Hlth  0.5646057 0.7007536 0.5738114 0.6716426 0.7966944 0.5568269 0.3526893
Utils 0.8045664 0.9078116 0.8377412 1.1349577 0.9170471 0.7590187 0.5759925
Other 0.7367730 0.8670658 0.7675101 0.9982543 0.8691936 0.6614378 0.5649510
           Hlth     Utils     Other
NoDur 0.5646057 0.8045664 0.7367730
Durbl 0.7007536 0.9078116 0.8670658
Manuf 0.5738114 0.8377412 0.7675101
Enrgy 0.6716426 1.1349577 0.9982543
HiTec 0.7966944 0.9170471 0.8691936
Telcm 0.5568269 0.7590187 0.6614378
Shops 0.3526893 0.5759925 0.5649510
Hlth  1.5726706 0.9572527 0.6958896
Utils 0.9572527 1.6137910 0.8231138
Other 0.6958896 0.8231138 0.8504170
           [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
 [1,] 0.4122081 0.4912224 0.3952464 0.4193134 0.4264027 0.3353647 0.3403724
 [2,] 0.4912224 1.1292610 0.7017455 0.7444757 0.7570624 0.5954278 0.6043187
 [3,] 0.3952464 0.7017455 0.6168984 0.5990186 0.6091461 0.4790919 0.4862457
 [4,] 0.4193134 0.7444757 0.5990186 1.5292134 0.6462377 0.5082645 0.5158539
 [5,] 0.4264027 0.7570624 0.6091461 0.6462377 0.7909042 0.5168576 0.5245753
 [6,] 0.3353647 0.5954278 0.4790919 0.5082645 0.5168576 0.5865664 0.4125773
 [7,] 0.3403724 0.6043187 0.4862457 0.5158539 0.5245753 0.4125773 0.5466103
 [8,] 0.4034409 0.7162946 0.5763435 0.6114378 0.6217753 0.4890248 0.4963269
 [9,] 0.2147284 0.3812424 0.3067545 0.3254331 0.3309352 0.2602797 0.2641662
[10,] 0.4139196 0.7348991 0.5913130 0.6273188 0.6379248 0.5017264 0.5092181
           [,8]      [,9]     [,10]
 [1,] 0.4034409 0.2147284 0.4139196
 [2,] 0.7162946 0.3812424 0.7348991
 [3,] 0.5763435 0.3067545 0.5913130
 [4,] 0.6114378 0.3254331 0.6273188
 [5,] 0.6217753 0.3309352 0.6379248
 [6,] 0.4890248 0.2602797 0.5017264
 [7,] 0.4963269 0.2641662 0.5092181
 [8,] 0.9527108 0.3131143 0.6035726
 [9,] 0.3131143 0.6251304 0.3212469
[10,] 0.6035726 0.3212469 0.6771910
           [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
 [1,] 0.4122098 0.4551202 0.3967492 0.3836431 0.4079362 0.3524612 0.3695621
 [2,] 0.4551202 1.1292698 0.7130944 0.7671604 0.7686299 0.5880595 0.5956349
 [3,] 0.3967492 0.7130944 0.6168989 0.6955396 0.6034184 0.4723637 0.4717160
 [4,] 0.3836431 0.7671604 0.6955396 1.5292549 0.5897334 0.4604431 0.4195944
 [5,] 0.4079362 0.7686299 0.6034184 0.5897334 0.7909018 0.5191879 0.5349897
 [6,] 0.3524612 0.5880595 0.4723637 0.4604431 0.5191879 0.5865696 0.4236824
 [7,] 0.3695621 0.5956349 0.4717160 0.4195944 0.5349897 0.4236824 0.5466084
 [8,] 0.4136421 0.7116877 0.5615150 0.5210792 0.6333049 0.4950579 0.5153197
 [9,] 0.2871422 0.3500511 0.3313275 0.4380579 0.2882521 0.2521583 0.2481792
[10,] 0.4112645 0.7383034 0.5919093 0.6061891 0.6441838 0.5009666 0.5131860
           [,8]      [,9]     [,10]
 [1,] 0.4136421 0.2871422 0.4112645
 [2,] 0.7116877 0.3500511 0.7383034
 [3,] 0.5615150 0.3313275 0.5919093
 [4,] 0.5210792 0.4380579 0.6061891
 [5,] 0.6333049 0.2882521 0.6441838
 [6,] 0.4950579 0.2521583 0.5009666
 [7,] 0.5153197 0.2481792 0.5131860
 [8,] 0.9527151 0.2836361 0.6058531
 [9,] 0.2836361 0.6251299 0.3042218
[10,] 0.6058531 0.3042218 0.6771909
          NoDur     Durbl     Manuf     Enrgy     HiTec     Telcm     Shops
NoDur 0.4105741 0.4569610 0.3958910 0.3884608 0.4076091 0.3494830 0.3665643
Durbl 0.4569610 1.1247860 0.7102018 0.7857384 0.7667748 0.5805496 0.6167802
Manuf 0.3958910 0.7102018 0.6144504 0.6886606 0.5999209 0.4695547 0.4682507
Enrgy 0.3884608 0.7857384 0.6886606 1.5231802 0.6045045 0.4714918 0.4321205
HiTec 0.4076091 0.7667748 0.5999209 0.6045045 0.7877644 0.5333288 0.5269993
Telcm 0.3494830 0.5805496 0.4695547 0.4714918 0.5333288 0.5842379 0.4240980
Shops 0.3665643 0.6167802 0.4682507 0.4321205 0.5269993 0.4240980 0.5444397
Hlth  0.4126879 0.6912130 0.5567415 0.5430641 0.6634584 0.4862834 0.4966024
Utils 0.2828707 0.3404854 0.3293606 0.4711433 0.3035876 0.2879218 0.2549747
Other 0.4094917 0.7250444 0.5910544 0.6025562 0.6338019 0.4957018 0.5111066
           Hlth     Utils     Other
NoDur 0.4126879 0.2828707 0.4094917
Durbl 0.6912130 0.3404854 0.7250444
Manuf 0.5567415 0.3293606 0.5910544
Enrgy 0.5430641 0.4711433 0.6025562
HiTec 0.6634584 0.3035876 0.6338019
Telcm 0.4862834 0.2879218 0.4957018
Shops 0.4966024 0.2549747 0.5111066
Hlth  0.9489291 0.3328408 0.6098666
Utils 0.3328408 0.6226643 0.2966387
Other 0.6098666 0.2966387 0.6745043
           [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
 [1,] 0.4122099 0.4562611 0.3372267 0.5309506 0.3818358 0.3288315 0.3174340
 [2,] 0.4562611 1.1292672 0.5581630 0.8788066 0.6319982 0.5442677 0.5254030
 [3,] 0.3372267 0.5581630 0.6168984 0.6495338 0.4671155 0.4022731 0.3883301
 [4,] 0.5309506 0.8788066 0.6495338 1.5292486 0.7354557 0.6333638 0.6114110
 [5,] 0.3818358 0.6319982 0.4671155 0.7354557 0.7909029 0.4554868 0.4396993
 [6,] 0.3288315 0.5442677 0.4022731 0.6333638 0.4554868 0.5865656 0.3786627
 [7,] 0.3174340 0.5254030 0.3883301 0.6114110 0.4396993 0.3786627 0.5466088
 [8,] 0.4190785 0.6936406 0.5126760 0.8071890 0.5804940 0.4999130 0.4825857
 [9,] 0.3394732 0.5618814 0.4152916 0.6538609 0.4702274 0.4049530 0.3909170
[10,] 0.3533222 0.5848036 0.4322336 0.6805354 0.4894105 0.4214732 0.4068647
           [,8]      [,9]     [,10]
 [1,] 0.4190785 0.3394732 0.3533222
 [2,] 0.6936406 0.5618814 0.5848036
 [3,] 0.5126760 0.4152916 0.4322336
 [4,] 0.8071890 0.6538609 0.6805354
 [5,] 0.5804940 0.4702274 0.4894105
 [6,] 0.4999130 0.4049530 0.4214732
 [7,] 0.4825857 0.3909170 0.4068647
 [8,] 0.9527097 0.5160914 0.5371455
 [9,] 0.5160914 0.6251451 0.4351130
[10,] 0.5371455 0.4351130 0.6771916
          NoDur     Durbl     Manuf     Enrgy     HiTec     Telcm     Shops
NoDur 0.4105741 0.4533887 0.3873626 0.4011317 0.4022539 0.3468151 0.3614773
Durbl 0.4533887 1.1247860 0.6897915 0.7943430 0.7490674 0.5735603 0.6053055
Manuf 0.3873626 0.6897915 0.6144504 0.6845123 0.5813984 0.4591553 0.4563270
Enrgy 0.4011317 0.7943430 0.6845123 1.5231802 0.6137493 0.4856250 0.4460931
HiTec 0.4022539 0.7490674 0.5813984 0.6137493 0.7877644 0.5235490 0.5157821
Telcm 0.3468151 0.5735603 0.4591553 0.4856250 0.5235490 0.5842379 0.4185212
Shops 0.3614773 0.6053055 0.4563270 0.4460931 0.5157821 0.4185212 0.5444397
Hlth  0.4126248 0.6876067 0.5479009 0.5668471 0.6539358 0.4861689 0.4937870
Utils 0.2922477 0.3622248 0.3385262 0.4987594 0.3199038 0.3019712 0.2693772
Other 0.4016274 0.7061521 0.5704292 0.6069342 0.6151733 0.4854606 0.4982046
           Hlth     Utils     Other
NoDur 0.4126248 0.2922477 0.4016274
Durbl 0.6876067 0.3622248 0.7061521
Manuf 0.5479009 0.3385262 0.5704292
Enrgy 0.5668471 0.4987594 0.6069342
HiTec 0.6539358 0.3199038 0.6151733
Telcm 0.4861689 0.3019712 0.4854606
Shops 0.4937870 0.2693772 0.4982046
Hlth  0.9489291 0.3540456 0.6000208
Utils 0.3540456 0.6226643 0.3099585
Other 0.6000208 0.3099585 0.6745043
          NoDur     Durbl     Manuf     Enrgy     HiTec     Telcm     Shops
NoDur 0.4189328 0.4430639 0.3866408 0.3723949 0.3966306 0.3420253 0.3603814
Durbl 0.4430639 1.1171388 0.6950283 0.7640205 0.7507699 0.5655698 0.6044175
Manuf 0.3866408 0.6950283 0.6182401 0.6749792 0.5863265 0.4579076 0.4568528
Enrgy 0.3723949 0.7640205 0.6749792 1.5066048 0.5816274 0.4522866 0.4109090
HiTec 0.3966306 0.7507699 0.5863265 0.5816274 0.7876700 0.5226195 0.5162572
Telcm 0.3420253 0.5655698 0.4579076 0.4522866 0.5226195 0.5887047 0.4155374
Shops 0.3603814 0.6044175 0.4568528 0.4109090 0.5162572 0.4155374 0.5497983
Hlth  0.4026370 0.6716897 0.5413834 0.5174765 0.6509928 0.4734552 0.4847491
Utils 0.2786044 0.3235803 0.3193247 0.4640008 0.2897795 0.2795289 0.2447872
Other 0.4003127 0.7094491 0.5792792 0.5823696 0.6211332 0.4847338 0.5014126
           Hlth     Utils     Other
NoDur 0.4026370 0.2786044 0.4003127
Durbl 0.6716897 0.3235803 0.7094491
Manuf 0.5413834 0.3193247 0.5792792
Enrgy 0.5174765 0.4640008 0.5823696
HiTec 0.6509928 0.2897795 0.6211332
Telcm 0.4734552 0.2795289 0.4847338
Shops 0.4847491 0.2447872 0.5014126
Hlth  0.9452229 0.3213718 0.5966257
Utils 0.3213718 0.6262699 0.2839273
Other 0.5966257 0.2839273 0.6769482
          NoDur     Durbl     Manuf     Enrgy     HiTec     Telcm     Shops
NoDur 0.4105741 0.4449471 0.3882842 0.3739777 0.3983165 0.3434791 0.3619132
Durbl 0.4449471 1.1247860 0.6979825 0.7672680 0.7539610 0.5679737 0.6069865
Manuf 0.3882842 0.6979825 0.6144504 0.6778481 0.5888186 0.4598539 0.4587946
Enrgy 0.3739777 0.7672680 0.6778481 1.5231802 0.5840996 0.4542090 0.4126556
HiTec 0.3983165 0.7539610 0.5888186 0.5840996 0.7877644 0.5248409 0.5184516
Telcm 0.3434791 0.5679737 0.4598539 0.4542090 0.5248409 0.5842379 0.4173036
Shops 0.3619132 0.6069865 0.4587946 0.4126556 0.5184516 0.4173036 0.5444397
Hlth  0.4043484 0.6745447 0.5436845 0.5196760 0.6537598 0.4754676 0.4868095
Utils 0.2797886 0.3249556 0.3206820 0.4659730 0.2910112 0.2807170 0.2458276
Other 0.4020142 0.7124646 0.5817414 0.5848449 0.6237733 0.4867942 0.5035438
           Hlth     Utils     Other
NoDur 0.4043484 0.2797886 0.4020142
Durbl 0.6745447 0.3249556 0.7124646
Manuf 0.5436845 0.3206820 0.5817414
Enrgy 0.5196760 0.4659730 0.5848449
HiTec 0.6537598 0.2910112 0.6237733
Telcm 0.4754676 0.2807170 0.4867942
Shops 0.4868095 0.2458276 0.5035438
Hlth  0.9489291 0.3227378 0.5991616
Utils 0.3227378 0.6226643 0.2851341
Other 0.5991616 0.2851341 0.6745043
          NoDur     Durbl     Manuf     Enrgy     HiTec     Telcm     Shops
NoDur 0.4105741 0.4569610 0.3958910 0.3884608 0.4076091 0.3494830 0.3665643
Durbl 0.4569610 1.1247860 0.7102018 0.7857384 0.7667748 0.5805496 0.6167802
Manuf 0.3958910 0.7102018 0.6144504 0.6886606 0.5999209 0.4695547 0.4682507
Enrgy 0.3884608 0.7857384 0.6886606 1.5231802 0.6045045 0.4714918 0.4321205
HiTec 0.4076091 0.7667748 0.5999209 0.6045045 0.7877644 0.5333288 0.5269993
Telcm 0.3494830 0.5805496 0.4695547 0.4714918 0.5333288 0.5842379 0.4240980
Shops 0.3665643 0.6167802 0.4682507 0.4321205 0.5269993 0.4240980 0.5444397
Hlth  0.4126879 0.6912130 0.5567415 0.5430641 0.6634584 0.4862834 0.4966024
Utils 0.2828707 0.3404854 0.3293606 0.4711433 0.3035876 0.2879218 0.2549747
Other 0.4094917 0.7250444 0.5910544 0.6025562 0.6338019 0.4957018 0.5111066
           Hlth     Utils     Other
NoDur 0.4126879 0.2828707 0.4094917
Durbl 0.6912130 0.3404854 0.7250444
Manuf 0.5567415 0.3293606 0.5910544
Enrgy 0.5430641 0.4711433 0.6025562
HiTec 0.6634584 0.3035876 0.6338019
Telcm 0.4862834 0.2879218 0.4957018
Shops 0.4966024 0.2549747 0.5111066
Hlth  0.9489291 0.3328408 0.6098666
Utils 0.3328408 0.6226643 0.2966387
Other 0.6098666 0.2966387 0.6745043

RiskPortfolios documentation built on May 17, 2021, 1:10 a.m.