Hi all,

I am currently trying to calculate the Marginal expected shortfall (MES) based on the following paper: https://www.ecb.europa.eu/pub/pdf/sc...46c5b2af9e10c7
I have no clue how to calculate the tail expectations in stata (as pictured below).

Does anyone have a line of code or knows which function to use to calculate these tail expectations?


Array
Thanks!
Thom