[Returnanalytics-commits] r2834 - in pkg/PerformanceAnalytics/sandbox/Shubhankit: . R man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 20 13:46:18 CEST 2013


Author: shubhanm
Date: 2013-08-20 13:46:18 +0200 (Tue, 20 Aug 2013)
New Revision: 2834

Added:
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Gsoc-iid.Rproj
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/AcarSim.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDD.Opt.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CalmarRatio.Norm.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/SterlingRatio.Norm.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/AcarSim.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CDD.Opt.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CalmarRatio.Norm.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CalmarRatio.Normalized.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/SterlingRatio.Norm.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/table.EmaxDDGBM.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/ACFSTDEV-Graph10.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/ACFSTDEV.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/ACFSTDEV.rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/ConditionalDrawdown-Graph10.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/ConditionalDrawdown.Rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/ConditionalDrawdown.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/GLMReturn-Graph1.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/GLMReturn-Graph10.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/GLMReturn.Rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/GLMReturn.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/GLMSmoothIndex.Rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/GLMSmoothIndex.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/LoSharpe.Rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/LoSharpeRatio.Rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/LoSharpeRatio.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/MaximumLoss.Rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/NormCalmar-Graph10.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/NormCalmar.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/NormCalmar.rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/OkunevWhite-Graph1.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/OkunevWhite-Graph10.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/OkunevWhite.Rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/OkunevWhite.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/Rplots.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/ShaneAcarMaxLoss-003.pdf
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/ShaneAcarMaxLoss.Rnw
   pkg/PerformanceAnalytics/sandbox/Shubhankit/vignettes/ShaneAcarMaxLoss.pdf
Modified:
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/ACStdDev.annualized.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDDopt.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDrawdown.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/EmaxDDGBM.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/GLMSmoothIndex.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/Return.GLM.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/chart.Autocorrelation.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.ComparitiveReturn.GLM.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.UnsmoothReturn.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.normDD.R
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/ACStdDev.annualized.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/Cdrawdown.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/GLMSmoothIndex.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/chart.Autocorrelation.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/table.ComparitiveReturn.GLM.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/table.NormDD.Rd
   pkg/PerformanceAnalytics/sandbox/Shubhankit/man/table.UnsmoothReturn.Rd
Log:
man/*.Rd files as well as /vignettes 
// for all codes written



Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/Gsoc-iid.Rproj
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/Gsoc-iid.Rproj	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/Gsoc-iid.Rproj	2013-08-20 11:46:18 UTC (rev 2834)
@@ -0,0 +1,17 @@
+Version: 1.0
+
+RestoreWorkspace: Yes
+SaveWorkspace: Yes
+AlwaysSaveHistory: Yes
+
+EnableCodeIndexing: Yes
+UseSpacesForTab: Yes
+NumSpacesForTab: 2
+Encoding: UTF-8
+
+RnwWeave: Sweave
+LaTeX: pdfLaTeX
+
+BuildType: Package
+PackageInstallArgs: --no-multiarch
+PackageRoxygenize: rd

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/ACStdDev.annualized.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/ACStdDev.annualized.R	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/ACStdDev.annualized.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -1,5 +1,5 @@
 #' @title Autocorrleation adjusted Standard Deviation 
-#'
+#' @description Incorporating the component of lagged autocorrelation factor into adjusted time scale standard deviation translation
 #' @aliases sd.multiperiod sd.annualized StdDev.annualized
 #' @param x an xts, vector, matrix, data frame, timeSeries or zoo object of
 #' asset returns

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/AcarSim.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/AcarSim.R	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/AcarSim.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -0,0 +1,89 @@
+#' @title Acar and Shane Maximum Loss 
+#' 
+#'@description To get some insight on the relationships between maximum drawdown per unit of volatility 
+#'and mean return divided by volatility, we have proceeded to Monte-Carlo simulations.
+#' We have simulated cash flows over a period of 36 monthly returns and measured maximum 
+#'drawdown for varied levels of annualised return divided by volatility varying from minus
+#' two to two by step of 0.1. The process has been repeated six thousand times.
+#' @param R an xts, vector, matrix, data frame, timeSeries or zoo object of
+#' asset returns
+#' @author Peter Carl, Brian Peterson, Shubhankit Mohan
+#' @references Maximum Loss and Maximum Drawdown in Financial Markets,\emph{International Conference Sponsored by BNP and Imperial College on: 
+#' Forecasting Financial Markets, London, United Kingdom, May 1997}
+#' @keywords Maximum Loss Simulared Drawdown
+#' @examples
+#' library(PerformanceAnalytics)
+#' AcarSim(edhec)
+#' @rdname AcarSim
+#' @export 
+AcarSim <-
+  function(R)
+  {
+    R = checkData(Ra, method="xts")
+    # Get dimensions and labels
+    # simulated parameters using edhec data
+mu=mean(Return.annualized(edhec))
+monthly=(1+mu)^(1/12)-1
+sig=StdDev.annualized(edhec[,1])[1];
+T= 36
+j=1
+dt=1/T
+nsim=6000;
+thres=4;
+r=matrix(0,nsim,T+1)
+monthly = 0
+r[,1]=monthly;
+# Sigma 'monthly volatiltiy' will be the varying term
+ratio= seq(-2, 2, by=.1);
+len = length(ratio)
+ddown=array(0, dim=c(nsim,len,thres))
+fddown=array(0, dim=c(len,thres))
+Z <- array(0, c(len))
+for(i in 1:len)
+{
+  monthly = sig*ratio[i];
+
+  for(j in 1:nsim)
+{
+    dz=rnorm(T)
+    
+    
+      r[j,2:37]=monthly+(sig*dz*sqrt(3*dt))
+    
+    ddown[j,i,1]= ES((r[j,]),.99)
+    ddown[j,i,1][is.na(ddown[j,i,1])] <- 0
+    fddown[i,1]=fddown[i,1]+ddown[j,i,1]
+    ddown[j,i,2]= ES((r[j,]),.95)
+    ddown[j,i,2][is.na(ddown[j,i,2])] <- 0
+    fddown[i,2]=fddown[i,2]+ddown[j,i,2]
+    ddown[j,i,3]= ES((r[j,]),.90)
+    ddown[j,i,3][is.na(ddown[j,i,3])] <- 0
+    fddown[i,3]=fddown[i,3]+ddown[j,i,3]
+    ddown[j,i,4]= ES((r[j,]),.85)
+    ddown[j,i,4][is.na(ddown[j,i,4])] <- 0
+    fddown[i,4]=fddown[i,4]+ddown[j,i,4]
+    assign("last.warning", NULL, envir = baseenv())
+}
+}
+plot(((fddown[,1])/(sig*nsim)),xlab="Annualised Return/Volatility from [-2,2]",ylab="Maximum Drawdown/Volatility",type='o',col="blue")
+lines(((fddown[,2])/(sig*nsim)),type='o',col="pink")
+lines(((fddown[,3])/(sig*nsim)),type='o',col="green")
+lines(((fddown[,4])/(sig*nsim)),type='o',col="red")
+legend(32,-4, c("%99", "%95", "%90","%85"), col = c("blue","pink","green","red"), text.col= "black",
+       lty = c(2, -1, 1), pch = c(-1, 3, 4), merge = TRUE, bg='gray90')
+
+title("Maximum Drawdown/Volatility as a function of Return/Volatility 
+36 monthly returns simulated 6,000 times") 
+}
+
+###############################################################################
+# R (http://r-project.org/) Econometrics for Performance and Risk Analysis
+#
+# Copyright (c) 2004-2012 Peter Carl and Brian G. Peterson
+#
+# This R package is distributed under the terms of the GNU Public License (GPL)
+# for full details see the file COPYING
+#
+# $Id: AcarSim.R 2163 2012-07-16 00:30:19Z braverock $
+#
+###############################################################################
\ No newline at end of file

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDD.Opt.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDD.Opt.R	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDD.Opt.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -0,0 +1,50 @@
+#' @title Chekhlov Conditional Drawdown at Risk Optimization
+#' 
+#' @description  A new one-parameter family of risk measures called Conditional Drawdown (CDD) has
+#'been proposed. These measures of risk are functionals of the portfolio drawdown (underwater) curve considered in active portfolio management. For some value of the tolerance
+#' parameter, in the case of a single sample path, drawdown functional is defineed as
+#'the mean of the worst (1 - \eqn{\alpha})% drawdowns. 
+#'@details This section formulates a portfolio optimization problem with drawdown risk measure and suggests efficient optimization techniques for its solving. Optimal asset
+#' allocation considers:
+#' \enumerate{
+#' \item Generation of sample paths for the assets' rates of return.
+#' \item Uncompounded cumulative portfolio rate of return rather than compounded one.
+#' }
+#' @param Ra return vector of the portfolio
+#' @param p confidence interval
+#' @author Peter Carl, Brian Peterson, Shubhankit Mohan
+#' @references DRAWDOWN MEASURE IN PORTFOLIO OPTIMIZATION,\emph{International Journal of Theoretical and Applied Finance}
+#' ,Fall 1994, 49-58.Vol. 8, No. 1 (2005) 13-58
+#' @keywords Conditional Drawdown models
+#' @examples
+#' 
+#'library(PerformanceAnalytics)
+#' data(edhec)
+#' CDDopt(edhec)
+#' @rdname CDD.Opt
+#' @export 
+
+CDD.Opt = function(rmat, alpha=0.05, rmin=0, wmin=0, wmax=1, weight.sum=1)
+{
+  require(Rglpk)
+  n = ncol(rmat) # number of assets
+  s = nrow(rmat) # number of scenarios i.e. periods
+  averet = colMeans(rmat)
+  # creat objective vector, constraint matrix, constraint rhs
+  Amat = rbind(cbind(rbind(1,averet),matrix(data=0,nrow=2,ncol=s+1)),
+               cbind(rmat,diag(s),1))
+  objL = c(rep(0,n), as.numeric(Cdrawdown(rmat,.9)), -1)
+  bvec = c(weight.sum,rmin,rep(0,s))
+  # direction vector
+  dir.vec = c("==",">=",rep(">=",s))
+  # bounds on weights
+  bounds = list(lower = list(ind = 1:n, val = rep(wmin,n)),
+                upper = list(ind = 1:n, val = rep(wmax,n)))
+  res = Rglpk_solve_LP(obj=objL, mat=Amat, dir=dir.vec, rhs=bvec,
+                       types=rep("C",length(objL)), max=T, bounds=bounds)
+  w = as.numeric(res$solution[1:n])
+  return(list(w=w,status=res$status))
+}
+#' Guy Yollin work
+#' 
+#' 

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDDopt.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDDopt.R	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDDopt.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -1,4 +1,29 @@
-cDDOpt = function(rmat, alpha=0.05, rmin=0, wmin=0, wmax=1, weight.sum=1)
+#' @title Chekhlov Conditional Drawdown at Risk
+#' 
+#' @description  A new one-parameter family of risk measures called Conditional Drawdown (CDD) has
+#'been proposed. These measures of risk are functionals of the portfolio drawdown (underwater) curve considered in active portfolio management. For some value of the tolerance
+#' parameter, in the case of a single sample path, drawdown functional is defineed as
+#'the mean of the worst (1 - \eqn{\alpha})% drawdowns. 
+#'@details This section formulates a portfolio optimization problem with drawdown risk measure and suggests e???cient optimization techniques for its solving. Optimal asset
+#' allocation considers:
+#' 1) Generation of sample paths for the assets' rates of return.
+#' 2) Uncompounded cumulative portfolio rate of return rather than compounded one.
+#'
+#' @param Ra return vector of the portfolio
+#' @param p confidence interval
+#' @author Peter Carl, Brian Peterson, Shubhankit Mohan
+#' @references DRAWDOWN MEASURE IN PORTFOLIO OPTIMIZATION,\emph{International Journal of Theoretical and Applied Finance}
+#' ,Fall 1994, 49-58.Vol. 8, No. 1 (2005) 13-58
+#' @keywords Conditional Drawdown models
+#' @examples
+#' 
+#'     library(PerformanceAnalytics)
+#' data(edhec)
+#' CDDopt(edhec)
+#' @rdname Cdrawdown
+#' @export 
+
+CDDOpt = function(rmat, alpha=0.05, rmin=0, wmin=0, wmax=1, weight.sum=1)
 {
   require(Rglpk)
   n = ncol(rmat) # number of assets

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDrawdown.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDrawdown.R	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CDrawdown.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -1,20 +1,18 @@
-#' Chekhlov Conditional Drawdown at Risk
+#' @title Chekhlov Conditional Drawdown at Risk
 #' 
-#' A new one-parameter family of risk measures called Conditional Drawdown (CDD) has
+#' @description  A new one-parameter family of risk measures called Conditional Drawdown (CDD) has
 #'been proposed. These measures of risk are functionals of the portfolio drawdown (underwater) curve considered in active portfolio management. For some value of the tolerance
-#' parameter, in the case of a single sample path, drawdown functional is de???ned as
-#'the mean of the worst 100% drawdowns. The CDD measure generalizes the
-#'notion of the drawdown functional to a multi-scenario case and can be considered as a
+#' parameter, in the case of a single sample path, drawdown functional is defineed as
+#'the mean of the worst (1 - \eqn{\alpha})% drawdowns. 
+#'@details The CDD measure generalizes the notion of the drawdown functional to a multi-scenario case and can be considered as a
 #'generalization of deviation measure to a dynamic case. The CDD measure includes the
-#'Maximal Drawdown and Average Drawdown as its limiting cases. 
-#' 
-#' The model is focused on concept of drawdown measure which is in possession of all properties of a deviation measure,generalization of deviation measures to a dynamic case.Concept of risk profiling - Mixed Conditional Drawdown (generalization of CDD).Optimization techniques for CDD computation - reduction to linear programming (LP) problem. Portfolio optimization with constraint on Mixed CDD
+#'Maximal Drawdown and Average Drawdown as its limiting cases. The model is focused on concept of drawdown measure which is in possession of all properties of a deviation measure,generalization of deviation measures to a dynamic case.Concept of risk profiling - Mixed Conditional Drawdown (generalization of CDD).Optimization techniques for CDD computation - reduction to linear programming (LP) problem. Portfolio optimization with constraint on Mixed CDD
 #' The model develops concept of drawdown measure by generalizing the notion
 #' of the CDD to the case of several sample paths for portfolio uncompounded rate
 #' of return.
 #' @param Ra return vector of the portfolio
 #' @param p confidence interval
-#' @author R Project
+#' @author Peter Carl, Brian Peterson, Shubhankit Mohan
 #' @references DRAWDOWN MEASURE IN PORTFOLIO OPTIMIZATION,\emph{International Journal of Theoretical and Applied Finance}
 #' ,Fall 1994, 49-58.Vol. 8, No. 1 (2005) 13-58
 #' @keywords Conditional Drawdown models

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CalmarRatio.Norm.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CalmarRatio.Norm.R	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/CalmarRatio.Norm.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -0,0 +1,69 @@
+#' @title Normalized Calmar reward/risk ratio
+#'  
+#' @description Normalized Calmar and Sterling Ratios are yet another method of creating a
+#' risk-adjusted measure for ranking investments similar to the Sharpe Ratio.
+#' 
+#' @details 
+#' Both the Normalized Calmar and the Sterling ratio are the ratio of annualized return
+#' over the absolute value of the maximum drawdown of an investment. The
+#' Sterling ratio adds an excess risk measure to the maximum drawdown,
+#' traditionally and defaulting to 10%.
+#' 
+#' It is also traditional to use a three year return series for these
+#' calculations, although the functions included here make no effort to
+#' determine the length of your series.  If you want to use a subset of your
+#' series, you'll need to truncate or subset the input data to the desired
+#' length.
+#' 
+#' 
+#' @param R an xts, vector, matrix, data frame, timeSeries or zoo object of
+#' asset returns
+#' @param scale number of periods in a year (daily scale = 252, monthly scale =
+#' 12, quarterly scale = 4)
+#' @param excess for Sterling Ratio, excess amount to add to the max drawdown,
+#' traditionally and default .1 (10\%)
+#' @author Brian G. Peterson , Peter Carl , Shubhankit Mohan
+#' @references Bacon, Carl. \emph{Magdon-Ismail, M. and Amir Atiya, Maximum drawdown. Risk Magazine, 01 Oct 2004.
+#' @keywords ts multivariate distribution models
+#' @examples
+#' 
+#'     data(managers)
+#'     CalmarRatio.Norm(managers[,1,drop=FALSE])
+#'     CalmarRatio.Norm(managers[,1:6]) 
+#' @export 
+#' @rdname CalmarRatio.Norm
+
+CalmarRatio.Norm <- function (R, tau = 1,scale = NA)
+{ # @author Brian G. Peterson
+  
+  # DESCRIPTION:
+  # Inputs:
+  # Ra: in this case, the function anticipates having a return stream as input,
+  #    rather than prices.
+  # tau : scaled Time in Years
+  # scale: number of periods per year
+  # Outputs:
+  # This function returns a Calmar Ratio
+  
+  # FUNCTION:
+  
+  R = checkData(R)
+  if(is.na(scale)) {
+    freq = periodicity(R)
+    switch(freq$scale,
+           minute = {stop("Data periodicity too high")},
+           hourly = {stop("Data periodicity too high")},
+           daily = {scale = 252},
+           weekly = {scale = 52},
+           monthly = {scale = 12},
+           quarterly = {scale = 4},
+           yearly = {scale = 1}
+    )
+  }
+  Time = nyears(R)
+  annualized_return = Return.annualized(R, scale=scale)
+  drawdown = abs(maxDrawdown(R))
+  result = (annualized_return/drawdown)*(QP.Norm(R,Time)/QP.Norm(R,tau))*(tau/Time)
+  rownames(result) = "Normalized Calmar Ratio"
+  return(result)
+}

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/EmaxDDGBM.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/EmaxDDGBM.R	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/EmaxDDGBM.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -5,7 +5,15 @@
 #' @param R an xts, vector, matrix, data frame, timeSeries or zoo object of  asset returns
 #' @author Peter Carl, Brian Peterson, Shubhankit Mohan
 #' @keywords Expected Drawdown Using Brownian Motion Assumptions
-#' @rdname EmaxDDGBM
+#' @references An Analysis of the maximum drawdown measure,\emph{Journal of Applied Probability}
+#' (2004) 
+#' @keywords Drawdown models Brownian Motion Assumptions
+#' @examples
+#' 
+#'library(PerformanceAnalytics)
+#' data(edhec)
+#' table.EmaxDDGBM(edhec)
+#' @rdname table.EmaxDDGBM
 #' @export 
 table.EMaxDDGBM <-
   function (R,digits =4)

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/GLMSmoothIndex.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/GLMSmoothIndex.R	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/GLMSmoothIndex.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -4,17 +4,17 @@
 #' a sum of square of Moving Average lag coefficient.
 #' This measure is well known in the industrial organization literature as the 
 #' Herfindahl index, a measure of the concentration of firms in a given industry. 
-#' The index is maximized when one coefficient is 1 and the rest are 0, in which case x ? 1: In the context of
+#' The index is maximized when one coefficient is 1 and the rest are 0. In the context of
 #'smoothed returns, a lower value of x implies more smoothing, and the upper bound
 #'of 1 implies no smoothing,  hence x is reffered as a ''smoothingindex' '.
 #' 
-#' \deqn{ R_t  =    {\mu} + {\beta}{{\delta}}_t+ \xi_t}
+#' \deqn{ R_t  =    \mu + \beta \delta_t+ \xi_t}
 #' @param R an xts, vector, matrix, data frame, timeSeries or zoo object of
 #' asset returns
-#' @author R
+#' @author Peter Carl, Brian Peterson, Shubhankit Mohan
 #' @aliases Return.Geltner
 #' @references "An econometric model of serial correlation and illiquidity in 
-#' hedge fund returns" Mila Getmansky1, Andrew W. Lo*, Igor Makarov
+#' hedge fund returns" Mila Getmansky, Andrew W. Lo, Igor Makarov
 #' 
 #' @keywords ts multivariate distribution models non-iid 
 #' @examples

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/Return.GLM.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/Return.GLM.R	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/Return.GLM.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -23,7 +23,7 @@
 #' @author Brian Peterson,Peter Carl, Shubhankit Mohan
 #' @references Mila Getmansky, Andrew W. Lo, Igor Makarov,\emph{An econometric model of serial correlation and 
 #' and illiquidity in hedge fund Returns},Journal of Financial Economics 74 (2004).
-#' @keywords ts multivariate distribution models
+#' @keywords ts multivariate distribution model
 Return.GLM <-
   function (Ra,q=3)
   { # @author Brian G. Peterson, Peter Carl

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/SterlingRatio.Norm.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/SterlingRatio.Norm.R	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/SterlingRatio.Norm.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -0,0 +1,68 @@
+#' @title Normalized Sterling reward/risk ratio
+#'  
+#' @description Normalized Sterling and Sterling Ratios are yet another method of creating a
+#' risk-adjusted measure for ranking investments similar to the Sharpe Ratio.
+#' 
+#' @details 
+#' Both the Normalized Sterling and the Calmar ratio are the ratio of annualized return
+#' over the absolute value of the maximum drawdown of an investment. The
+#' Sterling ratio adds an excess risk measure to the maximum drawdown,
+#' traditionally and defaulting to 10%.
+#' 
+#' It is also traditional to use a three year return series for these
+#' calculations, although the functions included here make no effort to
+#' determine the length of your series.  If you want to use a subset of your
+#' series, you'll need to truncate or subset the input data to the desired
+#' length.
+#' 
+#' 
+#' @param R an xts, vector, matrix, data frame, timeSeries or zoo object of
+#' asset returns
+#' @param scale number of periods in a year (daily scale = 252, monthly scale =
+#' 12, quarterly scale = 4)
+#' @param excess for Sterling Ratio, excess amount to add to the max drawdown,
+#' traditionally and default .1 (10\%)
+#' @author Brian G. Peterson , Peter Carl , Shubhankit Mohan
+#' @references Bacon, Carl. \emph{Magdon-Ismail, M. and Amir Atiya, Maximum drawdown. Risk Magazine, 01 Oct 2004.
+#' @keywords ts multivariate distribution models
+#' @examples
+#' 
+#'     data(managers)
+#'     SterlingRatio.Norm(managers[,1,drop=FALSE])
+#'     SterlingRatio.Norm(managers[,1:6]) 
+#' @export 
+#' @rdname SterlingRatio.Norm
+
+SterlingRatio.Norm <-
+  function (R, tau=1,scale=NA, excess=.1)
+  { # @author Brian G. Peterson
+    
+    # DESCRIPTION:
+    # Inputs:
+    # Ra: in this case, the function anticipates having a return stream as input,
+    #    rather than prices.
+    # scale: number of periods per year
+    # Outputs:
+    # This function returns a Sterling Ratio
+    
+    # FUNCTION:
+    Time = nyears(R)
+    R = checkData(R)
+    if(is.na(scale)) {
+      freq = periodicity(R)
+      switch(freq$scale,
+             minute = {stop("Data periodicity too high")},
+             hourly = {stop("Data periodicity too high")},
+             daily = {scale = 252},
+             weekly = {scale = 52},
+             monthly = {scale = 12},
+             quarterly = {scale = 4},
+             yearly = {scale = 1}
+      )
+    }
+    annualized_return = Return.annualized(R, scale=scale)
+    drawdown = abs(maxDrawdown(R)+excess)
+    result = annualized_return/drawdown*(QP.Norm(R,Time)/QP.Norm(R,tau))*(tau/Time)
+    rownames(result) = paste("Normalized Sterling Ratio (Excess = ", round(excess*100,0), "%)", sep="")
+    return(result)
+  }

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/chart.Autocorrelation.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/chart.Autocorrelation.R	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/chart.Autocorrelation.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -1,6 +1,6 @@
 #' @title Stacked Bar Autocorrelation Plot
 #' 
-#' @description A wrapper to create box and whiskers plot of comparitive inputs
+#' @description A wrapper to create box and whiskers plot of lagged autocorrelation analysis
 #' 
 #' @details We have also provided controls for all the symbols and lines in the chart.
 #' One default, set by \code{as.Tufte=TRUE}, will strip chartjunk and draw a

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.ComparitiveReturn.GLM.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.ComparitiveReturn.GLM.R	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.ComparitiveReturn.GLM.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -1,6 +1,6 @@
-#' Compenent Decomposition of Table of Unsmooth Returns for GLM Model
+#' @title Compenent Decomposition of Table of Unsmooth Returns for GLM Model
 #' 
-#' Creates a table of comparitive changes in Normality Properties for Third
+#' @description Creates a table of comparitive changes in Normality Properties for Third
 #' and Fourth Moment Vectors i.e. Skewness and Kurtosis for Orignal and Unsmooth 
 #' Returns Respectively
 #' 
@@ -9,9 +9,9 @@
 #' @param ci confidence interval, defaults to 95\%
 #' @param n number of series lags
 #' @param digits number of digits to round results to
-#' @author R
+#' @author Peter Carl, Brian Peterson, Shubhankit Mohan
 #' @keywords ts unsmooth GLM return models
-#'
+#' @rdname table.ComparitiveReturn.GLM
 #' @export 
 table.ComparitiveReturn.GLM <-
   function (R, n = 3, digits = 4)

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.UnsmoothReturn.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.UnsmoothReturn.R	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.UnsmoothReturn.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -1,6 +1,6 @@
-#' Compenent Decomposition of Table of Unsmooth Returns
+#' @title Compenent Decomposition of Table of Unsmooth Returns
 #' 
-#' Creates a table of estimates of moving averages for comparison across
+#' @description Creates a table of estimates of moving averages for comparison across
 #' multiple instruments or funds as well as their standard error and
 #' smoothing index
 #' 
@@ -10,9 +10,9 @@
 #' @param n number of series lags
 #' @param p confidence level for calculation, default p=.99
 #' @param digits number of digits to round results to
-#' @author R
+#' @author Peter Carl, Brian Peterson, Shubhankit Mohan
 #' @keywords ts smooth return models
-#'
+#' @rdname table.UnsmoothReturn
 #' @export 
 table.UnsmoothReturn <-
   function (R, n = 3, p= 0.95, digits = 4)

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.normDD.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.normDD.R	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/R/table.normDD.R	2013-08-20 11:46:18 UTC (rev 2834)
@@ -1,4 +1,6 @@
-#' To simulate net asset value (NAV) series where skewness and kurtosis are zero, 
+#'@title Generalised Lambda Distribution Simulated Drardown 
+#'
+#'@description  To simulate net asset value (NAV) series where skewness and kurtosis are zero, 
 #' we draw sample returns from a lognormal return distribution. To capture skewness 
 #' and kurtosis, we sample returns from a generalised lambda distribution.The values of 
 #' skewness and excess kurtosis used were roughly consistent with the range of values we 
@@ -10,11 +12,14 @@
 #' 
 #' @param R an xts, vector, matrix, data frame, timeSeries or zoo object of
 #' asset returns
-
-#' @author R
-#' @keywords Expected Drawdown Using Brownian Motion Assumptions
-#'
-#' @export 
+#' @references Burghardt, G., and L. Liu, \emph{ It's the Autocorrelation, Stupid (November 2012) Newedge
+#' working paper.}
+#'  \code{\link[stats]{}} \cr
+#' \url{http://www.amfmblog.com/assets/Newedge-Autocorrelation.pdf}
+#' @author Peter Carl, Brian Peterson, Shubhankit Mohan
+#' @keywords Simulated Drawdown Using Brownian Motion Assumptions
+#' @rdname table.normDD
+#' @export
 table.NormDD <-
   function (R,digits =4)
   {# @author 

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/man/ACStdDev.annualized.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/man/ACStdDev.annualized.Rd	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/man/ACStdDev.annualized.Rd	2013-08-20 11:46:18 UTC (rev 2834)
@@ -20,7 +20,9 @@
   \item{\dots}{any other passthru parameters}
 }
 \description{
-  Autocorrleation adjusted Standard Deviation
+  Incorporating the component of lagged autocorrelation
+  factor into adjusted time scale standard deviation
+  translation
 }
 \author{
   Peter Carl,Brian Peterson, Shubhankit Mohan

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/man/AcarSim.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/man/AcarSim.Rd	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/man/AcarSim.Rd	2013-08-20 11:46:18 UTC (rev 2834)
@@ -0,0 +1,38 @@
+\name{AcarSim}
+\alias{AcarSim}
+\title{Acar and Shane Maximum Loss}
+\usage{
+  AcarSim(R)
+}
+\arguments{
+  \item{R}{an xts, vector, matrix, data frame, timeSeries
+  or zoo object of asset returns}
+}
+\description{
+  To get some insight on the relationships between maximum
+  drawdown per unit of volatility and mean return divided
+  by volatility, we have proceeded to Monte-Carlo
+  simulations. We have simulated cash flows over a period
+  of 36 monthly returns and measured maximum drawdown for
+  varied levels of annualised return divided by volatility
+  varying from minus two to two by step of 0.1. The process
+  has been repeated six thousand times.
+}
+\examples{
+library(PerformanceAnalytics)
+AcarSim(edhec)
+}
+\author{
+  Peter Carl, Brian Peterson, Shubhankit Mohan
+}
+\references{
+  Maximum Loss and Maximum Drawdown in Financial
+  Markets,\emph{International Conference Sponsored by BNP
+  and Imperial College on: Forecasting Financial Markets,
+  London, United Kingdom, May 1997}
+}
+\keyword{Drawdown}
+\keyword{Loss}
+\keyword{Maximum}
+\keyword{Simulared}
+

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CDD.Opt.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CDD.Opt.Rd	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CDD.Opt.Rd	2013-08-20 11:46:18 UTC (rev 2834)
@@ -0,0 +1,49 @@
+\name{CDD.Opt}
+\alias{CDD.Opt}
+\title{Chekhlov Conditional Drawdown at Risk Optimization}
+\usage{
+  CDD.Opt(rmat, alpha = 0.05, rmin = 0, wmin = 0, wmax = 1,
+    weight.sum = 1)
+}
+\arguments{
+  \item{Ra}{return vector of the portfolio}
+
+  \item{p}{confidence interval}
+}
+\description{
+  A new one-parameter family of risk measures called
+  Conditional Drawdown (CDD) has been proposed. These
+  measures of risk are functionals of the portfolio
+  drawdown (underwater) curve considered in active
+  portfolio management. For some value of the tolerance
+  parameter, in the case of a single sample path, drawdown
+  functional is defineed as the mean of the worst (1 -
+  \eqn{\alpha})% drawdowns.
+}
+\details{
+  This section formulates a portfolio optimization problem
+  with drawdown risk measure and suggests efficient
+  optimization techniques for its solving. Optimal asset
+  allocation considers: \enumerate{ \item Generation of
+  sample paths for the assets' rates of return. \item
+  Uncompounded cumulative portfolio rate of return rather
+  than compounded one. }
+}
+\examples{
+library(PerformanceAnalytics)
+data(edhec)
+CDDopt(edhec)
+}
+\author{
+  Peter Carl, Brian Peterson, Shubhankit Mohan
+}
+\references{
+  DRAWDOWN MEASURE IN PORTFOLIO
+  OPTIMIZATION,\emph{International Journal of Theoretical
+  and Applied Finance} ,Fall 1994, 49-58.Vol. 8, No. 1
+  (2005) 13-58
+}
+\keyword{Conditional}
+\keyword{Drawdown}
+\keyword{models}
+

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CalmarRatio.Norm.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CalmarRatio.Norm.Rd	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CalmarRatio.Norm.Rd	2013-08-20 11:46:18 UTC (rev 2834)
@@ -0,0 +1,52 @@
+\name{CalmarRatio.Norm}
+\alias{CalmarRatio.Norm}
+\title{Normalized Calmar reward/risk ratio}
+\usage{
+  CalmarRatio.Norm(R, tau = 1, scale = NA)
+}
+\arguments{
+  \item{R}{an xts, vector, matrix, data frame, timeSeries
+  or zoo object of asset returns}
+
+  \item{scale}{number of periods in a year (daily scale =
+  252, monthly scale = 12, quarterly scale = 4)}
+
+  \item{excess}{for Sterling Ratio, excess amount to add to
+  the max drawdown, traditionally and default .1 (10\%)}
+}
+\description{
+  Normalized Calmar and Sterling Ratios are yet another
+  method of creating a risk-adjusted measure for ranking
+  investments similar to the Sharpe Ratio.
+}
+\details{
+  Both the Normalized Calmar and the Sterling ratio are the
+  ratio of annualized return over the absolute value of the
+  maximum drawdown of an investment. The Sterling ratio
+  adds an excess risk measure to the maximum drawdown,
+  traditionally and defaulting to 10%.
+
+  It is also traditional to use a three year return series
+  for these calculations, although the functions included
+  here make no effort to determine the length of your
+  series.  If you want to use a subset of your series,
+  you'll need to truncate or subset the input data to the
+  desired length.
+}
+\examples{
+data(managers)
+    CalmarRatio.Norm(managers[,1,drop=FALSE])
+    CalmarRatio.Norm(managers[,1:6])
+}
+\author{
+  Brian G. Peterson , Peter Carl , Shubhankit Mohan
+}
+\references{
+  Bacon, Carl. \emph{Magdon-Ismail, M. and Amir Atiya,
+  Maximum drawdown. Risk Magazine, 01 Oct 2004.
+}
+\keyword{distribution}
+\keyword{models}
+\keyword{multivariate}
+\keyword{ts}
+

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CalmarRatio.Normalized.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CalmarRatio.Normalized.Rd	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/man/CalmarRatio.Normalized.Rd	2013-08-20 11:46:18 UTC (rev 2834)
@@ -0,0 +1,7 @@
+\name{SterlingRatio.Normalized}
+\alias{SterlingRatio.Normalized}
+\usage{
+  SterlingRatio.Normalized(R, tau = 1, scale = NA,
+    excess = 0.1)
+}
+

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/man/Cdrawdown.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/man/Cdrawdown.Rd	2013-08-20 11:31:43 UTC (rev 2833)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/man/Cdrawdown.Rd	2013-08-20 11:46:18 UTC (rev 2834)
@@ -1,13 +1,21 @@
-\name{CDrawdown}
+\name{CDDOpt}
+\alias{CDDOpt}
 \alias{CDrawdown}
 \title{Chekhlov Conditional Drawdown at Risk}
 \usage{
+  CDDOpt(rmat, alpha = 0.05, rmin = 0, wmin = 0, wmax = 1,
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/returnanalytics -r 2834


More information about the Returnanalytics-commits mailing list