Conditional Value-at-Risk (VaR) and Expected Shortfall (ES)
ES.RdExtract the in-sample conditional Value-at-Risk, or the in-sample conditional Expected Shortfall for the chosen risk level(s).
Arguments
- object
an
arxorgetsobject- level
the risk level(s), must be between 0 and 1
- type
the method used to compute the empirical quantiles of the standardised residuals
- ...
arguments passed on (currently not used)
Value
A vector or matrix containing either the conditional Value-at-Risk (VaR) or the conditional Expected Shortfall (ES) for the chosen risk level(s).
Author
Genaro Sucarrat, http://www.sucarrat.net/
Examples
##generate random variates, estimate model:
y <- rnorm(50)
mymodel <- arx(y, arch=1)
##extract 99% expected shortfall:
ES(mymodel)
#> 1 2 3 4 5 6 7 8
#> NA 2.437264 2.041896 2.879399 2.277200 2.166494 2.094853 2.530472
#> 9 10 11 12 13 14 15 16
#> 2.533957 2.494753 2.334188 2.275044 2.063262 2.115464 2.312244 2.090721
#> 17 18 19 20 21 22 23 24
#> 2.347284 3.661955 2.301727 2.228251 2.328633 2.374621 2.157935 2.246122
#> 25 26 27 28 29 30 31 32
#> 2.078766 2.861363 2.223486 2.946719 2.248759 2.129686 2.203279 2.500887
#> 33 34 35 36 37 38 39 40
#> 2.445443 2.105182 2.574260 2.723861 2.086122 2.497984 2.468218 2.179590
#> 41 42 43 44 45 46 47 48
#> 2.641889 2.302919 4.793722 2.525927 2.337905 2.013820 2.692156 2.290478
#> 49 50
#> 2.565980 2.085965
##extract 99%, 95% and 90% expected shortfalls:
ES(mymodel, level=c(0.99, 0.95, 0.9))
#> ES0.99 ES0.95 ES0.9
#> 1 NA NA NA
#> 2 2.437264 2.149655 2.038027
#> 3 2.041896 1.801916 1.708774
#> 4 2.879399 2.538527 2.406226
#> 5 2.277200 2.008874 1.904730
#> 6 2.166494 1.911504 1.812536
#> 7 2.094853 1.848494 1.752876
#> 8 2.530472 2.231635 2.115648
#> 9 2.533957 2.234700 2.118551
#> 10 2.494753 2.200219 2.085903
#> 11 2.334188 2.058997 1.952188
#> 12 2.275044 2.006978 1.902934
#> 13 2.063262 1.820709 1.726568
#> 14 2.115464 1.866622 1.770040
#> 15 2.312244 2.039696 1.933913
#> 16 2.090721 1.844860 1.749435
#> 17 2.347284 2.070515 1.963094
#> 18 3.661955 3.226811 3.057919
#> 19 2.301727 2.030447 1.925155
#> 20 2.228251 1.965822 1.863966
#> 21 2.328633 2.054111 1.947562
#> 22 2.374621 2.094559 1.985860
#> 23 2.157935 1.903977 1.805409
#> 24 2.246122 1.981540 1.878848
#> 25 2.078766 1.834345 1.739479
#> 26 2.861363 2.522664 2.391206
#> 27 2.223486 1.961631 1.859998
#> 28 2.946719 2.597738 2.462289
#> 29 2.248759 1.983860 1.881045
#> 30 2.129686 1.879131 1.781884
#> 31 2.203279 1.943858 1.843170
#> 32 2.500887 2.205614 2.091011
#> 33 2.445443 2.156849 2.044838
#> 34 2.105182 1.857579 1.761478
#> 35 2.574260 2.270148 2.152114
#> 36 2.723861 2.401727 2.276698
#> 37 2.086122 1.840815 1.745605
#> 38 2.497984 2.203061 2.088593
#> 39 2.468218 2.176880 2.063804
#> 40 2.179590 1.923023 1.823442
#> 41 2.641889 2.329630 2.208434
#> 42 2.302919 2.031495 1.926148
#> 43 4.793722 4.222236 4.000427
#> 44 2.525927 2.227637 2.111863
#> 45 2.337905 2.062266 1.955283
#> 46 2.013820 1.777223 1.685393
#> 47 2.692156 2.373841 2.250295
#> 48 2.290478 2.020552 1.915787
#> 49 2.565980 2.262865 2.145219
#> 50 2.085965 1.840677 1.745474
##extract 99% value-at-risk:
VaR(mymodel)
#> 1 2 3 4 5 6 7 8
#> NA 2.250655 1.886190 2.658232 2.103102 2.001049 1.935008 2.336577
#> 9 10 11 12 13 14 15 16
#> 2.339791 2.303651 2.155636 2.101115 1.905887 1.954008 2.135407 1.931199
#> 17 18 19 20 21 22 23 24
#> 2.167708 3.379621 2.125712 2.057979 2.150515 2.192909 1.993160 2.074453
#> 25 26 27 28 29 30 31 32
#> 1.920178 2.641605 2.053587 2.720290 2.076884 1.967119 2.034959 2.309305
#> 33 34 35 36 37 38 39 40
#> 2.258195 1.944530 2.376943 2.514851 1.926960 2.306629 2.279189 2.013122
#> 41 42 43 44 45 46 47 48
#> 2.439286 2.126811 4.422925 2.332388 2.159063 1.860309 2.485624 2.115342
#> 49 50
#> 2.369310 1.926815
##extract 99%, 95% and 90% values-at-risk:
VaR(mymodel, level=c(0.99, 0.95, 0.9))
#> VaR0.99 VaR0.95 VaR0.9
#> 1 NA NA NA
#> 2 2.250655 1.947802 1.731862
#> 3 1.886190 1.633491 1.453311
#> 4 2.658232 2.299292 2.043361
#> 5 2.103102 1.820554 1.619092
#> 6 2.001049 1.732544 1.541095
#> 7 1.935008 1.675591 1.490622
#> 8 2.336577 2.021901 1.797530
#> 9 2.339791 2.024672 1.799986
#> 10 2.303651 1.993505 1.772365
#> 11 2.155636 1.865859 1.659242
#> 12 2.101115 1.818840 1.617572
#> 13 1.905887 1.650477 1.468365
#> 14 1.954008 1.691977 1.505143
#> 15 2.135407 1.848413 1.643781
#> 16 1.931199 1.672306 1.487711
#> 17 2.167708 1.876270 1.668468
#> 18 3.379621 2.921411 2.594699
#> 19 2.125712 1.840053 1.636372
#> 20 2.057979 1.781640 1.584605
#> 21 2.150515 1.861442 1.655328
#> 22 2.192909 1.898002 1.687728
#> 23 1.993160 1.725740 1.535065
#> 24 2.074453 1.795847 1.597196
#> 25 1.920178 1.662802 1.479288
#> 26 2.641605 2.284954 2.030654
#> 27 2.053587 1.777852 1.581248
#> 28 2.720290 2.352810 2.090791
#> 29 2.076884 1.797944 1.599054
#> 30 1.967119 1.703283 1.515163
#> 31 2.034959 1.761788 1.567012
#> 32 2.309305 1.998382 1.776687
#> 33 2.258195 1.954304 1.737625
#> 34 1.944530 1.683803 1.497899
#> 35 2.376943 2.056711 1.828380
#> 36 2.514851 2.175642 1.933780
#> 37 1.926960 1.668651 1.484471
#> 38 2.306629 1.996074 1.774641
#> 39 2.279189 1.972410 1.753670
#> 40 2.013122 1.742955 1.550322
#> 41 2.439286 2.110476 1.876028
#> 42 2.126811 1.841000 1.637211
#> 43 4.422925 3.821147 3.392068
#> 44 2.332388 2.018288 1.794328
#> 45 2.159063 1.868813 1.661860
#> 46 1.860309 1.611171 1.433531
#> 47 2.485624 2.150437 1.911442
#> 48 2.115342 1.831109 1.628446
#> 49 2.369310 2.050129 1.822547
#> 50 1.926815 1.668525 1.484360