Conditional Value-at-Risk (VaR) and Expected Shortfall (ES)
ES.Rd
Extract the in-sample conditional Value-at-Risk, or the in-sample conditional Expected Shortfall for the chosen risk level(s).
Arguments
- object
an
arx
orgets
object- 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)
#> Warning:
#>
#> New default 'mc = TRUE' in arx() as of version 0.28
#> This warning only appears the first time arx() is invoked
#> To suppress this warning, set options(mc.warning = FALSE)
##extract 99% expected shortfall:
ES(mymodel)
#> 1 2 3 4 5 6 7 8
#> NA 1.936948 2.437264 1.750214 3.100744 2.150171 1.953261 1.845047
#> 9 10 11 12 13 14 15 16
#> 2.822709 2.833070 2.720507 2.324843 2.146301 1.774875 1.882906 2.213164
#> 17 18 19 20 21 22 23 24
#> 1.837523 2.354211 3.539351 2.194244 2.100634 2.242658 2.325362 1.962710
#> 25 26 27 28 29 30 31 32
#> 2.094489 1.801252 5.935343 2.091040 3.169212 2.142369 1.909355 2.018193
#> 33 34 35 36 37 38 39 40
#> 2.548935 2.451759 1.846552 2.673493 3.594995 1.829174 2.729474 2.648705
#> 41 42 43 44 45 46 47 48
#> 1.976308 2.782538 2.256312 3.501649 2.809309 2.259346 1.691855 2.859025
#> 49 50
#> 2.174019 2.659726
##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 1.936948 1.840929 1.710999
#> 3 2.437264 2.315162 2.149938
#> 4 1.750214 1.663930 1.547172
#> 5 3.100744 2.944054 2.732026
#> 6 2.150171 2.043036 1.898064
#> 7 1.953261 1.856391 1.725311
#> 8 1.845047 1.753818 1.630371
#> 9 2.822709 2.680513 2.488099
#> 10 2.833070 2.690334 2.497189
#> 11 2.720507 2.583639 2.398435
#> 12 2.324843 2.208602 2.051309
#> 13 2.146301 2.039367 1.894669
#> 14 1.774875 1.687305 1.568808
#> 15 1.882906 1.789703 1.663586
#> 16 2.213164 2.102745 1.953330
#> 17 1.837523 1.746686 1.623770
#> 18 2.354211 2.236439 2.077074
#> 19 3.539351 3.359796 3.116828
#> 20 2.194244 2.084812 1.936731
#> 21 2.100634 1.996081 1.854604
#> 22 2.242658 2.130702 1.979206
#> 23 2.325362 2.209094 2.051764
#> 24 1.962710 1.865347 1.733600
#> 25 2.094489 1.990257 1.849213
#> 26 1.801252 1.712307 1.591949
#> 27 5.935343 5.630881 5.218893
#> 28 2.091040 1.986987 1.846187
#> 29 3.169212 3.008952 2.792095
#> 30 2.142369 2.035640 1.891219
#> 31 1.909355 1.814774 1.686790
#> 32 2.018193 1.917938 1.782277
#> 33 2.548935 2.421011 2.247910
#> 34 2.451759 2.328902 2.162655
#> 35 1.846552 1.755245 1.631692
#> 36 2.673493 2.539076 2.357188
#> 37 3.594995 3.412539 3.165646
#> 38 1.829174 1.738773 1.616446
#> 39 2.729474 2.592139 2.406302
#> 40 2.648705 2.515580 2.335441
#> 41 1.976308 1.878237 1.745530
#> 42 2.782538 2.642436 2.452856
#> 43 2.256312 2.143643 1.991185
#> 44 3.501649 3.324059 3.083751
#> 45 2.809309 2.667812 2.476343
#> 46 2.259346 2.146520 1.993847
#> 47 1.691855 1.608613 1.495972
#> 48 2.859025 2.714936 2.519960
#> 49 2.174019 2.065641 1.918987
#> 50 2.659726 2.526027 2.345110
##extract 99% value-at-risk:
VaR(mymodel)
#> 1 2 3 4 5 6 7 8
#> NA 1.874409 2.357737 1.694016 2.998689 2.080392 1.890168 1.785628
#> 9 10 11 12 13 14 15 16
#> 2.730094 2.740104 2.631362 2.249134 2.076653 1.717839 1.822201 2.141246
#> 17 18 19 20 21 22 23 24
#> 1.778359 2.277504 3.422404 2.122969 2.032537 2.169739 2.249634 1.899296
#> 25 26 27 28 29 30 31 32
#> 2.026601 1.743321 5.737042 2.023269 3.064832 2.072855 1.847753 1.952895
#> 33 34 35 36 37 38 39 40
#> 2.465616 2.371740 1.787082 2.585945 3.476158 1.770294 2.640026 2.561998
#> 41 42 43 44 45 46 47 48
#> 1.912433 2.691287 2.182929 3.385982 2.717150 2.185861 1.637638 2.765177
#> 49 50
#> 2.103431 2.572646
##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 1.874409 1.720491 1.376101
#> 3 2.357737 2.162009 1.724070
#> 4 1.694016 1.555702 1.246227
#> 5 2.998689 2.747517 2.185521
#> 6 2.080392 1.908656 1.524397
#> 7 1.890168 1.734887 1.387447
#> 8 1.785628 1.639390 1.312183
#> 9 2.730094 2.502157 1.992148
#> 10 2.740104 2.511300 1.999354
#> 11 2.631362 2.411965 1.921066
#> 12 2.249134 2.062801 1.645882
#> 13 2.076653 1.905240 1.521705
#> 14 1.717839 1.577465 1.263379
#> 15 1.822201 1.672800 1.338514
#> 16 2.141246 1.964246 1.568209
#> 17 1.778359 1.632750 1.306950
#> 18 2.277504 2.088717 1.666307
#> 19 3.422404 3.134579 2.490573
#> 20 2.122969 1.947550 1.555050
#> 21 2.032537 1.864940 1.489944
#> 22 2.169739 1.990274 1.588722
#> 23 2.249634 2.063258 1.646242
#> 24 1.899296 1.743225 1.394018
#> 25 2.026601 1.859518 1.485670
#> 26 1.743321 1.600742 1.281724
#> 27 5.737042 5.248993 4.156986
#> 28 2.023269 1.856474 1.483271
#> 29 3.064832 2.807938 2.233141
#> 30 2.072855 1.901771 1.518971
#> 31 1.847753 1.696141 1.356910
#> 32 1.952895 1.792188 1.432606
#> 33 2.465616 2.260557 1.801738
#> 34 2.371740 2.174801 1.734152
#> 35 1.787082 1.640718 1.313230
#> 36 2.585945 2.370477 1.888368
#> 37 3.476158 3.183683 2.529273
#> 38 1.770294 1.625383 1.301144
#> 39 2.640026 2.419879 1.927303
#> 40 2.561998 2.348602 1.871128
#> 41 1.912433 1.755226 1.403476
#> 42 2.691287 2.466707 1.964209
#> 43 2.182929 2.002323 1.598218
#> 44 3.385982 3.101307 2.464351
#> 45 2.717150 2.490332 1.982828
#> 46 2.185861 2.005001 1.600329
#> 47 1.637638 1.504201 1.205638
#> 48 2.765177 2.534205 2.017405
#> 49 2.103431 1.929702 1.540984
#> 50 2.572646 2.358328 1.878793