Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

Calculation expected shortfall of a distribution in R?

$
0
0

I tried to calculate the expected shortfall of my modified distribution function. I used "PerformanceAnalytics" package.

Fx=c(0.02469009, 0.07225651, 0.11750310, 0.16054298, 0.20148378, 0.24042788, 
0.27747265, 0.31271072, 0.34623021, 0.37811494, 0.40844464, 0.43729513, 
0.46473857, 0.49084358, 0.51567543, 0.53929622, 0.56176501, 0.58313798, 0.60346858, 0.62280765, 0.64120353, 0.65870224, 0.67534753, 0.69118102,  0.70624230, 0.72056903, 0.73419704, 0.74716040, 0.75949154, 0.77122127, 0.78237894, 0.79299245, 0.80308832, 0.81269182, 0.82182695,0.83051655, 0.83878236, 0.84664503, 0.85412424, 0.86123869, 0.86800616, 0.87444357,
0.88056703, 0.88639185, 0.89193258, 0.89720309, 0.90221656, 0.90698551, 0.91152188,0.91583701, 0.91994169, 0.92384618, 0.92756024, 0.93109317, 0.93445380, 0.93765052,0.94069134, 0.94358386, 0.94633531, 0.94895257, 0.99840417, 0.99842013, 0.99843531,0.99844975, 0.99846348, 0.99847654 ,0.99848897 ,0.99850079, 0.99851204, 0.99852273, 0.99853291,1)

library(PerformanceAnalytics)
ES(Fx,p=0.95)

ES calculation produces unreliable result (inverse risk) for column: 1 : -0.169916309516024
   [,1]
ES   NA

I tried not only the distribution function but also the discrete probability distribution but it gives the same warnings. I also looked at the VaRES package. But my distribution does not belong to any specific parametric distribution.

Is it a way or a different package for the calculation of expected shortfall a distribution?


Viewing all articles
Browse latest Browse all 201867

Trending Articles