VaRModelling           package:fPortfolio           R Documentation

_V_a_l_u_e-_a_t-_R_i_s_k _M_e_a_s_u_r_e_s _f_o_r _P_o_r_t_f_o_l_i_o_s

_D_e_s_c_r_i_p_t_i_o_n:

     A collection and description of functions to  compute
     Value-at-Risk and related risk measures  for a portfolio of
     assets. In addition utility  functions are available to compute
     the maximum  loss, to calculate the total return, and to  plot a
     histogram of the total return. 

     The functions are:

       'pfolioVaR'           computes Value-at-Risk for a portfolio of assets,
       'pfolioCVaRplus'      computes Value-at-Risk+ for a portfolio of assets,
       'pfolioCVaR'          computes Conditional Value-at-Risk for a PF of assets,
       'lambdaCVaR'          computes CVaR's atomic split value lambda,
       'pfolioMaxLoss'       computes Maximum Loss for a portfolio of assets,
       'pfolioReturn'        computes return values of a portfolio,
       'pfolioTargetReturn'  computes the target return of a portfolio,
       'pfolioTargetRisk'    computes the target risk of a portfolio,
       'pfolioHist'          plots a histogram of the returns of a portfolio.

_U_s_a_g_e:

     pfolioVaR(x, weights = NULL, alpha = 0.05) 
     pfolioCVaRplus(x, weights = NULL, alpha = 0.05) 
     pfolioCVaR(x, weights = NULL, alpha = 0.05) 
     lambdaCVaR(n, alpha = 0.05) 

     pfolioMaxLoss(x, weights = NULL)
     pfolioReturn(x, weights = NULL) 
     pfolioTargetReturn(x, weights = NULL)
     pfolioTargetRisk(x, weights = NULL)
     pfolioHist(x, weights = NULL, alpha = 0.05, range = NULL, details = TRUE, ...)

_A_r_g_u_m_e_n_t_s:

   alpha: a numeric value, the confidence interval, by default 0.05. 

 details: a logical value, should details be printed? 

       n: the number of observation from which the CVaR's atomic split 
          value 'lambda=1-floor(alpha*n)/(alpha*n)' will be  evaluated. 

 weights: usually a numeric vector which has the length of the number
          of  assets. The weights measures the normalized weights of
          the  individual assets. By default 'NULL', then an equally 
          weighted set of assets is assumed.  

   range: a numeric vector of two elements limiting the plot range of
          the histogram. This is quite useful if one likes to compare
          several plots on the same scale. If 'range=NULL', the default
          value, then the range will be selected automatically. 

       x: a 'timeSeries' object, data frame or any other rectangular
          object which can be expressed as a matrix. The first 
          dimension is the number of observations, we call it 'n', and
          the second is the number of assets in the data set, we call
          it 'dim'. 

     ...: optional arguments to be passet to the function 'hist'. 

_D_e_t_a_i_l_s:

     The percentile measures of loss (or reward) are defined in the 
     following way: Let f(x ,y) be a loss functions depending  upon a
     decision vector x = (x_1, ..., x_n ) and a random  vector y =
     (y_1, ..., y_m), then 

     _pfolioVaR_ is the alpha-percentile of the loss distribution, a 
     smallest value such that the probability that losses exceed or 
     are equal to this value is greater or equal to alpha.

     _pfolioCVaRplus_ or "CVaR+" or the "upper CVaR" are the expected  
     losses strictly exceeding VaR. This is also also called "Mean 
     Excess Loss" and "Expected Shortfall".

     _pfolioCVaR_ is a weighted average of VaR and CVaRplus defined as
     CVaR = lambda*VaR + (1-lambda) CVaRplus, for  0 <= lambda <= 1.

     Note, CVaR is convex, but VaR and CVaRplus may be non-convex. The 
     following inequalities are valid: VaR <= CVaR <= CVaRplus.

_V_a_l_u_e:

     'pfolioVaR' 
      returns the value of risk, VaR,  for a portfolio of assets, a
     numeric value. 

     'pfolioCVaRplus' 
      returns the conditional value of risk plus, CVaRplus, for a 
     portfolio of assets, a numeric value. 

     'pfolioCVaR' 
      returns the conditional value of risk, CVaR, for a portfolio of
     assets, a numeric value. 

     'lambdaCVaR' 
      returns CVaR's atomic split value 'lambda', a numeric value. 

     'pfolioMaxLoss' 
      returns the maximum loss value of the portfolio, a numeric value. 

     'pfolioReturn' 
      returns the total portfolio return computed from the set of
     assets 'x', a numeric vector. 

     'pfolioTargetReturn' 
      returns the total return or target return computed from the set
     of assets 'x' and weights 'weights', a numeric value. 

     'pfolioTargetRisk' 
      returns the total risk (Sigma) or target risk computed from the
     set  of assets 'x' and 'weights' via the formual 'sqrt(weights %*%
     cov(x) %*% weights)', a numeric value. 

     'pfolioHist' 
      plots a histogram of portfolio returns and adds the values for
     the VaR (blue), for the CVaRplus (red), and for the  maximum loss
     (green) to the histogram plot. The function  invisibly returns a
     list with the following elements: VaR, VaRplus, maxLoss, mean, and
     sd. If 'details' is 'TRUE',  then the result is printed.

_A_u_t_h_o_r(_s):

     Diethelm Wuertz for the Rmetrics port.

_R_e_f_e_r_e_n_c_e_s:

     Uryasev S. (2000); _Conditional Value-at-Risk (CVaR): Algorithms
     and Applications_, Risk Management and Financial Engineering Lab,
     University of Florida

_E_x_a_m_p_l_e_s:

     ## assetsSim -
        myAssets = 100/12 * assetsSim(n = 120, dim = 4)
        # Plot Cumulated Returns of the Assets:
        prices = apply(myAssets, 2, FUN = cumsum)
        par(mfrow = c(2, 1), cex = 0.7)
        ts.plot(prices, col = 1:4, ylim = c(-300, 300))
        legend(0, 300, legend = colnames(myAssets), pch = "----", col = 1:4)
        title(main = "Cumulated Returns", ylab = "Cumulated Returns")
        abline(h = 0, lty = 3)
         
     ## pfolioCVaR -
        equalWeights = rep(1/4, 4)
        alpha = 0.10
        # Value at Risk:
        pfolioVaR(myAssets, equalWeights, alpha)
        # Conditional Value at Risk Plus:
        pfolioCVaRplus(myAssets, equalWeights, alpha)
        # Conditional Value at Risk Plus:
        pfolioCVaR(myAssets, equalWeights, alpha)
        # Lambda - Atomic Split Value:
        lambdaCVaR(120, alpha) 

     ## pfolioHist - 
        # Maximum Loss Value of the Portfolio
        pfolioMaxLoss(myAssets, equalWeights)
        # Compute Portfolio Returns:
        r = pfolioReturn(myAssets, equalWeights) 
        head(r)
        # Target Return and Target Risk:
        pfolioTargetReturn(myAssets, equalWeights)
        pfolioTargetRisk(myAssets, equalWeights)
        # Plot:
        pfolioHist(myAssets, equalWeights, alpha, n = 20)    

