I've been working on calculating parametric ES assuming the returns follow Paretian stable law. Given the four parameters - $\alpha, \beta,\sigma,\mu$- Stoyanov introduces closed form solution of the problem (assuming returns as the r.v., not losses - hence VaR is the negative quantile and we are integrating over the left tail, as I understand it. - see below.
I have been struggling for two days with implementing this in R
, but I cannot get the results they publish at the end of the paper - expect for a special symmetric case ($\beta=0$)
Any ideas where I could possibly go wrong?
Here are my results: I use integrate
in R
for the integral and it seems to give reasonable values of the integral with absolute error around 1e-04
.
Any help would be greatly appreciated.
> dat
alpha myES target relError integral myVaR absErrorIntegral subdivisions
1 1.04 160.837 157.204 0.023 -0.159 6.119 0.000 7
2 1.07 93.020 86.393 0.077 -0.166 5.755 0.000 6
3 1.10 66.317 58.302 0.137 -0.174 5.430 0.000 5
4 1.13 52.234 43.331 0.205 -0.184 5.140 0.000 4
5 1.16 43.650 34.082 0.281 -0.194 4.878 0.000 4
6 1.19 37.961 27.831 0.364 -0.205 4.642 0.000 4
7 1.22 33.996 23.344 0.456 -0.217 4.428 0.000 4
8 1.25 31.154 19.979 0.559 -0.231 4.234 0.000 3
9 1.28 29.094 17.369 0.675 -0.246 4.057 0.000 3
10 1.31 27.617 15.292 0.806 -0.264 3.895 0.000 3
11 1.34 26.599 13.604 0.955 -0.283 3.746 0.000 3
12 1.37 25.965 12.200 1.128 -0.305 3.610 0.000 2
13 1.40 25.672 11.030 1.327 -0.331 3.486 0.000 2
14 1.43 25.703 10.030 1.563 -0.360 3.371 0.000 2
15 1.46 26.058 9.170 1.842 -0.395 3.266 0.000 2
16 1.49 26.758 8.430 2.174 -0.436 3.169 0.000 2
17 1.52 27.840 7.771 2.583 -0.486 3.080 0.000 2
18 1.55 29.360 7.200 3.078 -0.546 2.998 0.000 2
19 1.58 31.399 6.680 3.701 -0.619 2.923 0.000 2
20 1.61 34.067 6.229 4.469 -0.710 2.854 0.000 2
21 1.64 37.506 5.817 5.448 -0.824 2.791 0.000 2
22 1.67 41.917 5.445 6.698 -0.967 2.733 0.000 2
23 1.70 47.576 5.100 8.329 -1.148 2.679 0.000 1
24 1.73 54.877 4.790 10.457 -1.383 2.630 0.000 2
25 1.76 64.422 4.500 13.316 -1.690 2.585 0.000 2
26 1.79 77.145 4.250 17.152 -2.103 2.544 0.000 2
27 1.82 94.616 4.010 22.595 -2.673 2.505 0.000 2
28 1.85 119.654 3.790 30.571 -3.497 2.470 0.000 3
29 1.88 157.937 3.580 43.116 -4.766 2.437 0.000 3
30 1.91 222.734 3.390 64.703 -6.928 2.406 0.000 3
31 1.94 353.958 3.220 108.925 -11.330 2.378 0.001 3
32 1.97 751.596 3.050 245.425 -24.725 2.351 0.001 4