[Returnanalytics-commits] r3676 - in pkg/Dowd: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 16 16:22:15 CEST 2015


Author: dacharya
Date: 2015-06-16 16:22:14 +0200 (Tue, 16 Jun 2015)
New Revision: 3676

Added:
   pkg/Dowd/R/GParetoMultipleMEFPlot.R
   pkg/Dowd/R/GParetoVaR.R
   pkg/Dowd/R/GumbelES.R
   pkg/Dowd/R/GumbelESPlot2DCl.R
   pkg/Dowd/R/GumbelVaR.R
   pkg/Dowd/R/GumbelVaRPlot2DCl.R
   pkg/Dowd/man/GParetoMultipleMEFPlot.Rd
   pkg/Dowd/man/GParetoVaR.Rd
   pkg/Dowd/man/GumbelES.Rd
   pkg/Dowd/man/GumbelESPlot2DCl.Rd
   pkg/Dowd/man/GumbelVaR.Rd
   pkg/Dowd/man/GumbelVaRPlot2DCl.Rd
Modified:
   pkg/Dowd/NAMESPACE
   pkg/Dowd/R/FrechetES.R
   pkg/Dowd/R/GParetoMEFPlot.R
   pkg/Dowd/man/FrechetES.Rd
   pkg/Dowd/man/GParetoMEFPlot.Rd
Log:
Gumbel Functions and remaining Gpareto functions: source and documentation.

Modified: pkg/Dowd/NAMESPACE
===================================================================
--- pkg/Dowd/NAMESPACE	2015-06-15 19:18:04 UTC (rev 3675)
+++ pkg/Dowd/NAMESPACE	2015-06-16 14:22:14 UTC (rev 3676)
@@ -24,8 +24,14 @@
 export(FrechetVaRPlot2DCl)
 export(GParetoES)
 export(GParetoMEFPlot)
+export(GParetoMultipleMEFPlot)
+export(GParetoVaR)
 export(GaussianCopulaVaR)
 export(GumbelCopulaVaR)
+export(GumbelES)
+export(GumbelESPlot2DCl)
+export(GumbelVaR)
+export(GumbelVaRPlot2DCl)
 export(HSES)
 export(HSVaR)
 export(HillEstimator)

Modified: pkg/Dowd/R/FrechetES.R
===================================================================
--- pkg/Dowd/R/FrechetES.R	2015-06-15 19:18:04 UTC (rev 3675)
+++ pkg/Dowd/R/FrechetES.R	2015-06-16 14:22:14 UTC (rev 3676)
@@ -13,7 +13,7 @@
 #' @param n Block size from which maxima are drawn
 #' @param cl Confidence level
 #' @param hp Holding period
-#' @return Value at Risk. If cl and hp are scalars, it returns scalar VaR. If cl
+#' @return Estimated ES. If cl and hp are scalars, it returns scalar VaR. If cl
 #' is vector and hp is a scalar, or viceversa, returns vector of VaRs. If both 
 #' cl and hp are vectors, returns a matrix of VaRs.
 #' 

Modified: pkg/Dowd/R/GParetoMEFPlot.R
===================================================================
--- pkg/Dowd/R/GParetoMEFPlot.R	2015-06-15 19:18:04 UTC (rev 3675)
+++ pkg/Dowd/R/GParetoMEFPlot.R	2015-06-16 14:22:14 UTC (rev 3676)
@@ -13,8 +13,8 @@
 #' @examples
 #' 
 #'    # Computes ES assuming generalised Pareto for following parameters
-#'    Ra <- 5 * randn(100)
-#'    mu <- 1
+#'    Ra <- 5 * rnorm(100)
+#'    mu <- 0
 #'    beta <- 1.2
 #'    zeta <- 1.6
 #'    GParetoMEFPlot(Ra, mu, beta, zeta)

Added: pkg/Dowd/R/GParetoMultipleMEFPlot.R
===================================================================
--- pkg/Dowd/R/GParetoMultipleMEFPlot.R	                        (rev 0)
+++ pkg/Dowd/R/GParetoMultipleMEFPlot.R	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,56 @@
+#' @title Plot of Emperical and 2 Generalised Pareto mean excess functions 
+#'
+#' @description Plots of emperical mean excess function and two generalized pareto mean excess functions which differ in their tail-index value.
+#'
+#' @param Ra Vector of daily Profit/Loss data 
+#' @param mu Location parameter
+#' @param beta Scale parameter
+#' @param zeta1 Assumed tail index for first mean excess function
+#' @param zeta2 Assumed tail index for second mean excess function
+#' 
+#' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
+#' 
+#' @author Dinesh Acharya
+#' @examples
+#' 
+#'    # Computes ES assuming generalised Pareto for following parameters
+#'    Ra <- 5 * rnorm(100)
+#'    mu <- 1
+#'    beta <- 1.2
+#'    zeta1 <- 1.6
+#'    zeta2 <- 2.2
+#'    GParetoMultipleMEFPlot(Ra, mu, beta, zeta1, zeta2)
+#'
+#' @export
+GParetoMultipleMEFPlot <- function(Ra, mu, beta, zeta1, zeta2) {
+  x <- as.vector(Ra)
+  x <- sort(x) 
+  u <- x
+  n <- length(u)
+  mef <- double(n - 1)
+  
+  for (i in 1:(n - 1)) {
+    x <- x[which(x > u[i])]
+    mef[i] <- mean(x) - u[i]
+  }
+  
+  u <- t(u)
+  u <- u[u!=max(u)]
+  gpmef1 <-  (1 + zeta1 * (u - mu) / beta)/(1 - zeta1);
+  gpmef2 <-  (1 + zeta2 * (u - mu) / beta)/(1 - zeta2);
+  # Plot
+  # Limits of axis
+  xlims <- c(min(u),max(u))
+  ylims <- c(min(mef, gpmef1, gpmef2), max(mef, gpmef1, gpmef2))
+  plot(u , mef, xlims, ylims, type = "l", xlab = "Threshold (u)", 
+       col = 5, ylab = "e(u)")
+  par(new = TRUE)
+  plot(u , gpmef1, xlims, ylims, type = "l", xlab = "Threshold (u)", 
+       col = 4, ylab = "e(u)")
+  par(new = TRUE)
+  plot(u , gpmef2, xlims, ylims, type = "l", xlab = "Threshold (u)", 
+       col = 3, ylab = "e(u)")
+  title("Emperical and Two Generalised Pareto MEFs")
+  legend("topright", legend = c("Emperical MEF", "Generalized Pareto MEF1", "Generalized Pareto MEF1"), text.col = c(5,4,3))
+  
+}
\ No newline at end of file

Added: pkg/Dowd/R/GParetoVaR.R
===================================================================
--- pkg/Dowd/R/GParetoVaR.R	                        (rev 0)
+++ pkg/Dowd/R/GParetoVaR.R	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,48 @@
+#' @title VaR for Generalized Pareto
+#'
+#' @description Estimates the Value at Risk of a portfolio assuming losses are 
+#' distributed as a generalised Pareto.
+#'
+#' @param Ra Vector of daily Profit/Loss data 
+#' @param beta Assumed scale parameter
+#' @param zeta Assumed tail index
+#' @param threshold.prob Threshold probability corresponding to threshold u and 
+#' x
+#' @param cl VaR confidence level
+#' 
+#' @return Expected Shortfall
+#' 
+#' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
+#' 
+#' McNeil, A., Extreme value theory for risk managers. Mimeo, ETHZ, 1999.
+#' 
+#' @author Dinesh Acharya
+#' @examples
+#' 
+#'    # Computes ES assuming generalised Pareto for following parameters
+#'    Ra <- 5 * randn(100)
+#'    beta <- 1.2
+#'    zeta <- 1.6
+#'    threshold.prob <- .85
+#'    cl <- .99
+#'    GParetoVaR(Ra, beta, zeta, threshold.prob, cl)
+#'
+#' @export
+GParetoVaR <- function(Ra, beta, zeta, threshold.prob, cl){
+  
+  if ( max(cl) >= 1){
+    stop("Confidence level(s) must be less than 1")
+  }
+  if ( min(cl) <= 0){
+    stop("Confidence level(s) must be greater than 0")
+  }
+  
+  x <- as.vector(Ra)
+  n <- length(x)
+  x <- sort(x)
+  Nu <- threshold.prob * n
+  Nu <- ((Nu >= 0) * floor(Nu) + (Nu < 0) * ceiling(Nu))
+  u <- x[n - Nu]
+  y <- u+(beta/zeta)*((((1/threshold.prob)*(1-cl))^(-zeta))-1)
+  
+}
\ No newline at end of file

Added: pkg/Dowd/R/GumbelES.R
===================================================================
--- pkg/Dowd/R/GumbelES.R	                        (rev 0)
+++ pkg/Dowd/R/GumbelES.R	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,77 @@
+#' @title Gumbel ES
+#'
+#' @description Estimates the ES of a portfolio assuming extreme losses are 
+#' Gumbel distributed, for specified confidence level and holding period. 
+#' Note that the long-right-hand tail is fitted to losses, not profits.
+#' 
+#' @param mu Location parameter for daily L/P
+#' @param sigma Assumed scale parameter for daily L/P
+#' @param n Assumed block size from which the maxima are drawn
+#' @param cl VaR confidence level
+#' @param hp VaR holding period
+#' @return Estimated ES. If cl and hp are scalars, it returns scalar VaR. If cl
+#' is vector and hp is a scalar, or viceversa, returns vector of VaRs. If both 
+#' cl and hp are vectors, returns a matrix of VaRs.
+#' 
+#' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
+#' 
+#' National Institute of Standards and Technology, Dataplot Reference Manual. Volume 1: Commands. NIST: Washington, DC, 1997, p. 8-67.
+#' 
+#' @author Dinesh Acharya
+#' @examples
+#' 
+#'    # Gumber ES Plot
+#'    GumbelES(0, 1.2, 100, c(.9,.88, .85, .8), 280)
+#'    
+#' @export
+GumbelES<- function(mu, sigma, n, cl, hp){
+  
+  # Check that inputs have correct dimensions
+  if (!length(mu) == 1) {
+    stop("Mean must be a scalar")
+  }
+  if (!length(sigma) == 1) {
+    stop("Standard Deviation must be a scalar")
+  }
+  if (!is.vector(cl)) {
+    stop("cl must be a vector")
+  }
+  if (!length(hp) == 1) {
+    stop("hp must be a scalar")
+  }
+  
+  # To check that cl is read as a scalar or row vector and hp is read as a scalar of column vector as required
+  cl <- t(as.matrix(cl))
+  hp <- as.matrix(hp)
+  
+  # Check that inputs obey sign and value restrictions
+  if (sigma < 0) {
+    stop("Standard deviation must be non-negative")
+  }
+  if (max(cl) >= 1) {
+    stop("Confidence levels must be less than 1")
+  }
+  if (min(cl) <= 0) {
+    stop("Confidence levels must be less than 1")
+  }
+  if (min(hp) <= 0) {
+    stop("Holding period must be greated than 0")
+  }
+  
+  # VaR Estimation
+  VaR <- mu * matrix(1, dim(cl)[1], dim(cl)[2]) - sigma * log(- n * log(cl)); # Gumberl VaR
+  
+  # ES Estimation
+  number.slices <- 1000 # Number of slices into which tail is divided
+  cl0 <- cl # Initial confidence level
+  term <- VaR
+  
+  delta.cl <- (1 - cl)/number.slices # Increment to confidence level as each slice is taken
+  for (i in 1:(number.slices - 1)) {
+    cl <- cl0 + i * delta.cl # Revised cl
+    term <- term + mu * matrix(1, dim(cl)[1], dim(cl)[2]) - sigma * log(-n * log(cl)) # NB Gumber term
+  }
+  y <- term / (number.slices - 1)
+  
+  return(y)
+}
\ No newline at end of file

Added: pkg/Dowd/R/GumbelESPlot2DCl.R
===================================================================
--- pkg/Dowd/R/GumbelESPlot2DCl.R	                        (rev 0)
+++ pkg/Dowd/R/GumbelESPlot2DCl.R	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,87 @@
+#' @title Gumbel VaR
+#'
+#' @description Estimates the EV VaR of a portfolio assuming extreme losses are Gumbel distributed, for specified confidence level and holding period.
+#'
+#' @param mu Location parameter for daily L/P
+#' @param sigma Assumed scale parameter for daily L/P
+#' @param n size from which the maxima are drawn
+#' @param cl VaR confidence level
+#' @param hp VaR holding period
+#' 
+#' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
+#' 
+#' 
+#' @author Dinesh Acharya
+#' @examples
+#' 
+#'    # Plots ES against Cl
+#'    GumbelESPlot2DCl(0, 1.2, 100, c(.9,.88, .85, .8), 280)
+#'
+#' @export
+GumbelESPlot2DCl<- function(mu, sigma, n, cl, hp){
+  
+  # Check that inputs have correct dimensions
+  if (!length(mu) == 1) {
+    stop("Mean must be a scalar")
+  }
+  if (!length(sigma) == 1) {
+    stop("Standard Deviation must be a scalar")
+  }
+  if (!is.vector(cl)) {
+    stop("cl must be a vector")
+  }
+  if (!length(hp) == 1) {
+    stop("hp must be a scalar")
+  }
+  
+  # To check that cl is read as a row vector as required
+  cl <- t(as.matrix(cl))
+  
+  # Check that inputs obey sign and value restrictions
+  if (sigma < 0) {
+    stop("Standard deviation must be non-negative")
+  }
+  if (max(cl) >= 1) {
+    stop("Confidence levels must be less than 1")
+  }
+  if (min(cl) <= 0) {
+    stop("Confidence levels must be less than 1")
+  }
+  if (min(hp) <= 0) {
+    stop("Holding period must be greated than 0")
+  }
+  
+  # VaR Estimation
+  VaR <- mu * matrix(1, dim(cl)[1], dim(cl)[2]) - sigma * log(- n * log(cl));
+  
+  # ES Estimation
+  number.slices <- 1000 # Number of slices into which tail is divided
+  cl0 <- cl # Initial confidence level
+  term <- VaR
+  
+  delta.cl <- (1 - cl)/number.slices # Increment to confidence level as each slice is taken
+  for (i in 1:(number.slices - 1)) {
+    cl <- cl0 + i * delta.cl # Revised cl
+    term <- term + mu * matrix(1, dim(cl)[1], dim(cl)[2]) - sigma * log(-n * log(cl)) # NB Gumber term
+  }
+  v <- term / (number.slices - 1)
+  
+  # Plotting
+  plot(cl0, v, xlab = "Confidence Level", ylab = "ES", type = "l")
+  
+  text(mean(cl0), 
+       max(v) - .1*(max(v) - min(v)),
+       'Input parameters')
+  text(mean(cl0), 
+       max(v)-.2*(max(v)-min(v)),
+       paste('Location parameter for daily L/P = ', mu))
+  text(mean(cl0), 
+       max(v) - .3 * (max(v) - min(v)),
+       paste('Scale parameter for daily L/P = ', sigma))
+  text(mean(cl0), 
+       max(v) - .4 * (max(v) - min(v)),
+       paste('Holding period = ', hp, ' days'))
+  
+  title("Gumbel ES against confidence level")
+  
+} 
\ No newline at end of file

Added: pkg/Dowd/R/GumbelVaR.R
===================================================================
--- pkg/Dowd/R/GumbelVaR.R	                        (rev 0)
+++ pkg/Dowd/R/GumbelVaR.R	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,59 @@
+#' @title Gumbel VaR
+#'
+#' @description Estimates the EV VaR of a portfolio assuming extreme losses are Gumbel distributed, for specified confidence level and holding period.
+#'
+#' @param mu Location parameter for daily L/P
+#' @param sigma Assumed scale parameter for daily L/P
+#' @param n Size from which the maxima are drawn
+#' @param cl VaR confidence level
+#' @param hp VaR holding period
+#' @return Estimated VaR
+#' 
+#' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
+#' 
+#' 
+#' @author Dinesh Acharya
+#' @examples
+#' 
+#'    # Gumbel VaR
+#'    GumbelVaR(0, 1.2, 100, c(.9,.88, .85, .8), 280)
+#'
+#' @export
+GumbelVaR<- function(mu, sigma, n, cl, hp){
+  
+  # Check that inputs have correct dimensions
+  if (!length(mu) == 1) {
+    stop("Mean must be a scalar")
+  }
+  if (!length(sigma) == 1) {
+    stop("Standard Deviation must be a scalar")
+  }
+  if (!is.vector(cl)) {
+    stop("cl must be a vector")
+  }
+  if (!length(hp) == 1) {
+    stop("hp must be a scalar")
+  }
+  
+  # To check that cl is read as a row vector as required
+  cl <- t(as.matrix(cl))
+  
+  # Check that inputs obey sign and value restrictions
+  if (sigma < 0) {
+    stop("Standard deviation must be non-negative")
+  }
+  if (max(cl) >= 1) {
+    stop("Confidence levels must be less than 1")
+  }
+  if (min(cl) <= 0) {
+    stop("Confidence levels must be less than 1")
+  }
+  if (min(hp) <= 0) {
+    stop("Holding period must be greated than 0")
+  }
+  
+  # VaR Estimation
+  y <- mu * matrix(1, dim(cl)[1], dim(cl)[2]) - sigma * log(- n * log(cl));
+  
+  return(y)
+} 
\ No newline at end of file

Added: pkg/Dowd/R/GumbelVaRPlot2DCl.R
===================================================================
--- pkg/Dowd/R/GumbelVaRPlot2DCl.R	                        (rev 0)
+++ pkg/Dowd/R/GumbelVaRPlot2DCl.R	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,74 @@
+#' @title Gumbel VaR
+#'
+#' @description Estimates the EV VaR of a portfolio assuming extreme losses are Gumbel distributed, for specified confidence level and holding period.
+#'
+#' @param mu Location parameter for daily L/P
+#' @param sigma Assumed scale parameter for daily L/P
+#' @param n size from which the maxima are drawn
+#' @param cl VaR confidence level
+#' @param hp VaR holding period
+#' 
+#' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
+#' 
+#' 
+#' @author Dinesh Acharya
+#' @examples
+#' 
+#'    # Plots VaR against Cl
+#'    GumbelVaRPlot2DCl(0, 1.2, 100, c(.9,.88, .85, .8), 280)
+#'
+#' @export
+GumbelVaRPlot2DCl<- function(mu, sigma, n, cl, hp){
+  
+  # Check that inputs have correct dimensions
+  if (!length(mu) == 1) {
+    stop("Mean must be a scalar")
+  }
+  if (!length(sigma) == 1) {
+    stop("Standard Deviation must be a scalar")
+  }
+  if (!is.vector(cl)) {
+    stop("cl must be a vector")
+  }
+  if (!length(hp) == 1) {
+    stop("hp must be a scalar")
+  }
+  
+  # To check that cl is read as a row vector as required
+  cl <- t(as.matrix(cl))
+  
+  # Check that inputs obey sign and value restrictions
+  if (sigma < 0) {
+    stop("Standard deviation must be non-negative")
+  }
+  if (max(cl) >= 1) {
+    stop("Confidence levels must be less than 1")
+  }
+  if (min(cl) <= 0) {
+    stop("Confidence levels must be less than 1")
+  }
+  if (min(hp) <= 0) {
+    stop("Holding period must be greated than 0")
+  }
+  
+  # VaR Estimation
+  VaR <- mu * matrix(1, dim(cl)[1], dim(cl)[2]) - sigma * log(- n * log(cl));
+  
+  # Plotting
+  plot(cl, VaR, xlab = "Confidence Level", ylab = "VaR", type = "l")
+  text(mean(cl), 
+       max(VaR) - .1*(max(VaR) - min(VaR)),
+       'Input parameters')
+  text(mean(cl), 
+       max(VaR)-.2*(max(VaR)-min(VaR)),
+       paste('Location parameter for daily L/P = ', mu))
+  text(mean(cl), 
+       max(VaR) - .3 * (max(VaR) - min(VaR)),
+       paste('Scale parameter for daily L/P = ', sigma))
+  text(mean(cl), 
+       max(VaR) - .4 * (max(VaR) - min(VaR)),
+       paste('Holding period = ', hp, ' days'))
+  
+  title("Gumbel VaR against confidence level")
+  
+} 
\ No newline at end of file

Modified: pkg/Dowd/man/FrechetES.Rd
===================================================================
--- pkg/Dowd/man/FrechetES.Rd	2015-06-15 19:18:04 UTC (rev 3675)
+++ pkg/Dowd/man/FrechetES.Rd	2015-06-16 14:22:14 UTC (rev 3676)
@@ -20,7 +20,7 @@
 \item{hp}{Holding period}
 }
 \value{
-Value at Risk. If cl and hp are scalars, it returns scalar VaR. If cl
+Estimated ES. If cl and hp are scalars, it returns scalar VaR. If cl
 is vector and hp is a scalar, or viceversa, returns vector of VaRs. If both
 cl and hp are vectors, returns a matrix of VaRs.
 }

Modified: pkg/Dowd/man/GParetoMEFPlot.Rd
===================================================================
--- pkg/Dowd/man/GParetoMEFPlot.Rd	2015-06-15 19:18:04 UTC (rev 3675)
+++ pkg/Dowd/man/GParetoMEFPlot.Rd	2015-06-16 14:22:14 UTC (rev 3676)
@@ -20,8 +20,8 @@
 }
 \examples{
 # Computes ES assuming generalised Pareto for following parameters
-   Ra <- 5 * randn(100)
-   mu <- 1
+   Ra <- 5 * rnorm(100)
+   mu <- 0
    beta <- 1.2
    zeta <- 1.6
    GParetoMEFPlot(Ra, mu, beta, zeta)

Added: pkg/Dowd/man/GParetoMultipleMEFPlot.Rd
===================================================================
--- pkg/Dowd/man/GParetoMultipleMEFPlot.Rd	                        (rev 0)
+++ pkg/Dowd/man/GParetoMultipleMEFPlot.Rd	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,38 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/GParetoMultipleMEFPlot.R
+\name{GParetoMultipleMEFPlot}
+\alias{GParetoMultipleMEFPlot}
+\title{Plot of Emperical and 2 Generalised Pareto mean excess functions}
+\usage{
+GParetoMultipleMEFPlot(Ra, mu, beta, zeta1, zeta2)
+}
+\arguments{
+\item{Ra}{Vector of daily Profit/Loss data}
+
+\item{mu}{Location parameter}
+
+\item{beta}{Scale parameter}
+
+\item{zeta1}{Assumed tail index for first mean excess function}
+
+\item{zeta2}{Assumed tail index for second mean excess function}
+}
+\description{
+Plots of emperical mean excess function and two generalized pareto mean excess functions which differ in their tail-index value.
+}
+\examples{
+# Computes ES assuming generalised Pareto for following parameters
+   Ra <- 5 * rnorm(100)
+   mu <- 1
+   beta <- 1.2
+   zeta1 <- 1.6
+   zeta2 <- 2.2
+   GParetoMultipleMEFPlot(Ra, mu, beta, zeta1, zeta2)
+}
+\author{
+Dinesh Acharya
+}
+\references{
+Dowd, K. Measuring Market Risk, Wiley, 2007.
+}
+

Added: pkg/Dowd/man/GParetoVaR.Rd
===================================================================
--- pkg/Dowd/man/GParetoVaR.Rd	                        (rev 0)
+++ pkg/Dowd/man/GParetoVaR.Rd	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,45 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/GParetoVaR.R
+\name{GParetoVaR}
+\alias{GParetoVaR}
+\title{VaR for Generalized Pareto}
+\usage{
+GParetoVaR(Ra, beta, zeta, threshold.prob, cl)
+}
+\arguments{
+\item{Ra}{Vector of daily Profit/Loss data}
+
+\item{beta}{Assumed scale parameter}
+
+\item{zeta}{Assumed tail index}
+
+\item{threshold.prob}{Threshold probability corresponding to threshold u and
+x}
+
+\item{cl}{VaR confidence level}
+}
+\value{
+Expected Shortfall
+}
+\description{
+Estimates the Value at Risk of a portfolio assuming losses are
+distributed as a generalised Pareto.
+}
+\examples{
+# Computes ES assuming generalised Pareto for following parameters
+   Ra <- 5 * randn(100)
+   beta <- 1.2
+   zeta <- 1.6
+   threshold.prob <- .85
+   cl <- .99
+   GParetoVaR(Ra, beta, zeta, threshold.prob, cl)
+}
+\author{
+Dinesh Acharya
+}
+\references{
+Dowd, K. Measuring Market Risk, Wiley, 2007.
+
+McNeil, A., Extreme value theory for risk managers. Mimeo, ETHZ, 1999.
+}
+

Added: pkg/Dowd/man/GumbelES.Rd
===================================================================
--- pkg/Dowd/man/GumbelES.Rd	                        (rev 0)
+++ pkg/Dowd/man/GumbelES.Rd	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,42 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/GumbelES.R
+\name{GumbelES}
+\alias{GumbelES}
+\title{Gumbel ES}
+\usage{
+GumbelES(mu, sigma, n, cl, hp)
+}
+\arguments{
+\item{mu}{Location parameter for daily L/P}
+
+\item{sigma}{Assumed scale parameter for daily L/P}
+
+\item{n}{Assumed block size from which the maxima are drawn}
+
+\item{cl}{VaR confidence level}
+
+\item{hp}{VaR holding period}
+}
+\value{
+Estimated ES. If cl and hp are scalars, it returns scalar VaR. If cl
+is vector and hp is a scalar, or viceversa, returns vector of VaRs. If both
+cl and hp are vectors, returns a matrix of VaRs.
+}
+\description{
+Estimates the ES of a portfolio assuming extreme losses are
+Gumbel distributed, for specified confidence level and holding period.
+Note that the long-right-hand tail is fitted to losses, not profits.
+}
+\examples{
+# Gumber ES Plot
+   GumbelES(0, 1.2, 100, c(.9,.88, .85, .8), 280)
+}
+\author{
+Dinesh Acharya
+}
+\references{
+Dowd, K. Measuring Market Risk, Wiley, 2007.
+
+National Institute of Standards and Technology, Dataplot Reference Manual. Volume 1: Commands. NIST: Washington, DC, 1997, p. 8-67.
+}
+

Added: pkg/Dowd/man/GumbelESPlot2DCl.Rd
===================================================================
--- pkg/Dowd/man/GumbelESPlot2DCl.Rd	                        (rev 0)
+++ pkg/Dowd/man/GumbelESPlot2DCl.Rd	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,33 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/GumbelESPlot2DCl.R
+\name{GumbelESPlot2DCl}
+\alias{GumbelESPlot2DCl}
+\title{Gumbel VaR}
+\usage{
+GumbelESPlot2DCl(mu, sigma, n, cl, hp)
+}
+\arguments{
+\item{mu}{Location parameter for daily L/P}
+
+\item{sigma}{Assumed scale parameter for daily L/P}
+
+\item{n}{size from which the maxima are drawn}
+
+\item{cl}{VaR confidence level}
+
+\item{hp}{VaR holding period}
+}
+\description{
+Estimates the EV VaR of a portfolio assuming extreme losses are Gumbel distributed, for specified confidence level and holding period.
+}
+\examples{
+# Plots ES against Cl
+   GumbelESPlot2DCl(0, 1.2, 100, c(.9,.88, .85, .8), 280)
+}
+\author{
+Dinesh Acharya
+}
+\references{
+Dowd, K. Measuring Market Risk, Wiley, 2007.
+}
+

Added: pkg/Dowd/man/GumbelVaR.Rd
===================================================================
--- pkg/Dowd/man/GumbelVaR.Rd	                        (rev 0)
+++ pkg/Dowd/man/GumbelVaR.Rd	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,36 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/GumbelVaR.R
+\name{GumbelVaR}
+\alias{GumbelVaR}
+\title{Gumbel VaR}
+\usage{
+GumbelVaR(mu, sigma, n, cl, hp)
+}
+\arguments{
+\item{mu}{Location parameter for daily L/P}
+
+\item{sigma}{Assumed scale parameter for daily L/P}
+
+\item{n}{Size from which the maxima are drawn}
+
+\item{cl}{VaR confidence level}
+
+\item{hp}{VaR holding period}
+}
+\value{
+Estimated VaR
+}
+\description{
+Estimates the EV VaR of a portfolio assuming extreme losses are Gumbel distributed, for specified confidence level and holding period.
+}
+\examples{
+# Gumbel VaR
+   GumbelVaR(0, 1.2, 100, c(.9,.88, .85, .8), 280)
+}
+\author{
+Dinesh Acharya
+}
+\references{
+Dowd, K. Measuring Market Risk, Wiley, 2007.
+}
+

Added: pkg/Dowd/man/GumbelVaRPlot2DCl.Rd
===================================================================
--- pkg/Dowd/man/GumbelVaRPlot2DCl.Rd	                        (rev 0)
+++ pkg/Dowd/man/GumbelVaRPlot2DCl.Rd	2015-06-16 14:22:14 UTC (rev 3676)
@@ -0,0 +1,33 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/GumbelVaRPlot2DCl.R
+\name{GumbelVaRPlot2DCl}
+\alias{GumbelVaRPlot2DCl}
+\title{Gumbel VaR}
+\usage{
+GumbelVaRPlot2DCl(mu, sigma, n, cl, hp)
+}
+\arguments{
+\item{mu}{Location parameter for daily L/P}
+
+\item{sigma}{Assumed scale parameter for daily L/P}
+
+\item{n}{size from which the maxima are drawn}
+
+\item{cl}{VaR confidence level}
+
+\item{hp}{VaR holding period}
+}
+\description{
+Estimates the EV VaR of a portfolio assuming extreme losses are Gumbel distributed, for specified confidence level and holding period.
+}
+\examples{
+# Plots VaR against Cl
+   GumbelVaRPlot2DCl(0, 1.2, 100, c(.9,.88, .85, .8), 280)
+}
+\author{
+Dinesh Acharya
+}
+\references{
+Dowd, K. Measuring Market Risk, Wiley, 2007.
+}
+



More information about the Returnanalytics-commits mailing list