Serving the Quantitative Finance Community

 
User avatar
nadim216
Topic Author
Posts: 0
Joined: July 27th, 2009, 1:22 pm

Value at risk and CVaR

December 7th, 2009, 8:50 pm

Hello,I need to add VaR function and CVaR to matlab library. Is someone could help me to generate two M-files nadim216
 
User avatar
willsmith
Posts: 2
Joined: January 14th, 2008, 11:59 pm

Value at risk and CVaR

December 17th, 2009, 9:52 am

Is this for computational finance PhD classes with William Shaw? Because I wrote this just last week...For empirical data, without giving the exact answer, use the quantile() function for both. The 2nd (cVaR) take the mean of all values less than the quantile. E.g. quantile(sort(returns),0.05) for VaR
 
User avatar
shalit
Posts: 0
Joined: February 6th, 2010, 9:14 pm

Value at risk and CVaR

February 7th, 2010, 8:12 pm

Willsmith HiI think you should look at the absolute Lorenz curve (ALC) to get CVaR. You can look at some papers by Ogry and Ruscz. Very easy to implement for data. I have a paper on the Lorenz.ALC= Cumsum[Sort[returns]], where Cumsum is the cumulative sum function( exists in some mathematica packages and in Matlab too). calculate the empirical CDF=pCVaR=-ALC(p)/pIn quantile form ALC(p)= integral from 0 to p (Quantile[Sort[return],t]Dt)
 
User avatar
acastaldo
Posts: 14
Joined: October 11th, 2002, 11:24 pm

Value at risk and CVaR

February 12th, 2010, 12:34 am

Here it is in the R Language:#value at risk and conditional value at riskVaR<-quantile(x,probs=0.05)CVaR<-mean(x[x<VaR])