# # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # # Parametric Value-at-Risk and Expected-Shortfall calculations # #----- VaR_norm = function(alpha,mu,sgma,S=1){ # The VaR under the assumption of a normal-distribution - S * ( mu + qnorm(alpha) * sgma ) } ES_norm = function(alpha,mu,sgma,S=1){ # The ES under the assumption of a normal-distribution S * ( - mu + sgma * ( dnorm(qnorm(alpha))/alpha ) ) } VaR_t = function(alpha,mu,lambda,nu,S=1){ # The VaR under the assumption of a t-distribution - S * ( mu + qt(alpha,nu) * lambda ) } ES_t = function(alpha,mu,lambda,nu,S=1){ # The ES under the assumption of a t-distribution S * ( - mu + lambda * ( dt(qt(alpha,nu),nu) / alpha ) * ( ( nu + qt(alpha,nu)^2 )/( nu - 1 ) ) ) }