[Returnanalytics-commits] r2638 - in pkg/PerformanceAnalytics/sandbox/Shubhankit: Week1/Code Week5/Code

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 24 13:10:58 CEST 2013


Author: shubhanm
Date: 2013-07-24 13:10:58 +0200 (Wed, 24 Jul 2013)
New Revision: 2638

Added:
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/Return.Okunev.R
Modified:
   pkg/PerformanceAnalytics/sandbox/Shubhankit/Week5/Code/CDrawdown.R
Log:
Added : Okunev Model for Unsmoothed Return (Tested and Implemented)

Added: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/Return.Okunev.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/Return.Okunev.R	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/Week1/Code/Return.Okunev.R	2013-07-24 11:10:58 UTC (rev 2638)
@@ -0,0 +1,20 @@
+quad <- function(R,d)
+{
+  coeff = as.numeric(acf(as.numeric(edhec[,1]), plot = FALSE)[1:2][[1]])
+b=-(1+coeff[2]-2*d*coeff[1])
+c=(coeff[1]-d)
+  ans= (-b-sqrt(b*b-4*c*c))/(2*c)
+  a <- a[!is.na(a)]
+  return(c(ans))               
+}
+Return.Okunev<-function(R,q=3)
+{
+  column.okunev=R
+  column.okunev <- column.okunev[!is.na(column.okunev)]
+  for(i in 1:q)
+  {
+    lagR = lag(column.okunev, k=i)
+    column.okunev= (column.okunev-(lagR*quad(lagR,0)))/(1-quad(lagR,0))
+  }
+  return(c(column.okunev))
+}

Modified: pkg/PerformanceAnalytics/sandbox/Shubhankit/Week5/Code/CDrawdown.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/Shubhankit/Week5/Code/CDrawdown.R	2013-07-24 02:56:50 UTC (rev 2637)
+++ pkg/PerformanceAnalytics/sandbox/Shubhankit/Week5/Code/CDrawdown.R	2013-07-24 11:10:58 UTC (rev 2638)
@@ -1,5 +1,36 @@
+#' Active Premium or Active Return
+#' 
+#' The return on an investment's annualized return minus the benchmark's
+#' annualized return.
+#' 
+#' Active Premium = Investment's annualized return - Benchmark's annualized
+#' return
+#' 
+#' Also commonly referred to as 'active return'.
+#' 
+#' @param Ra return vector of the portfolio
+#' @param Rb return vector of the benchmark asset
+#' @param scale number of periods in a year (daily scale = 252, monthly scale =
+#' 12, quarterly scale = 4)
+#' @author Peter Carl
+#' @seealso \code{\link{InformationRatio}} \code{\link{TrackingError}}
+#' \code{\link{Return.annualized}}
+#' @references Sharpe, W.F. The Sharpe Ratio,\emph{Journal of Portfolio
+#' Management},Fall 1994, 49-58.
+#' @keywords ts multivariate distribution models
+#' @examples
+#' 
+#'     data(managers)
+#'     ActivePremium(managers[, "HAM1", drop=FALSE], managers[, "SP500 TR", drop=FALSE])
+#'     ActivePremium(managers[,1,drop=FALSE], managers[,8,drop=FALSE]) 
+#'     ActivePremium(managers[,1:6], managers[,8,drop=FALSE]) 
+#'     ActivePremium(managers[,1:6], managers[,8:7,drop=FALSE])
+#' @rdname ActivePremium
+#' @aliases ActivePremium, ActiveReturn
+#' @export 
+
 CDrawdown <-
-  function (R,p=0.95, ...)
+  function (R,p=0.90, ...)
   {
     y = checkData(R, method = "xts")
     columns = ncol(y)



More information about the Returnanalytics-commits mailing list