[Returnanalytics-commits] r3039 - in pkg/PerformanceAnalytics/sandbox/pulkit: R man week1/code

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 10 00:33:05 CEST 2013


Author: pulkit
Date: 2013-09-10 00:33:05 +0200 (Tue, 10 Sep 2013)
New Revision: 3039

Modified:
   pkg/PerformanceAnalytics/sandbox/pulkit/R/DrawdownBeta.R
   pkg/PerformanceAnalytics/sandbox/pulkit/R/DrawdownBetaMulti.R
   pkg/PerformanceAnalytics/sandbox/pulkit/man/BenchmarkSR.Rd
   pkg/PerformanceAnalytics/sandbox/pulkit/man/MaxDD.Rd
   pkg/PerformanceAnalytics/sandbox/pulkit/man/MinTrackRecord.Rd
   pkg/PerformanceAnalytics/sandbox/pulkit/man/ProbSharpeRatio.Rd
   pkg/PerformanceAnalytics/sandbox/pulkit/man/REDDCOPS.Rd
   pkg/PerformanceAnalytics/sandbox/pulkit/man/TuW.Rd
   pkg/PerformanceAnalytics/sandbox/pulkit/man/chart.BenchmarkSR.Rd
   pkg/PerformanceAnalytics/sandbox/pulkit/man/chart.SRIndifference.Rd
   pkg/PerformanceAnalytics/sandbox/pulkit/man/golden_section.Rd
   pkg/PerformanceAnalytics/sandbox/pulkit/week1/code/PSROpt.py
Log:
na handling in drawdown beta and multi path drawdown beta

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/R/DrawdownBeta.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/R/DrawdownBeta.R	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/R/DrawdownBeta.R	2013-09-09 22:33:05 UTC (rev 3039)
@@ -69,10 +69,10 @@
     # The Drawdown beta is given as the output.   
 
 
-    R = na.omit(R)
-    Rm = na.omit(Rm)
     x = checkData(R)
     xm = checkData(Rm)
+    x = na.omit(x)
+    xm = na.omit(xm)
     if(nrow(x) != nrow(xm)){
         stop("The number of rows of the return series and the optimal portfolio should be equal")
     }

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/R/DrawdownBetaMulti.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/R/DrawdownBetaMulti.R	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/R/DrawdownBetaMulti.R	2013-09-09 22:33:05 UTC (rev 3039)
@@ -59,9 +59,14 @@
     # OUTPUT:
     # The Drawdown beta for multiple sample path is given as the output.   
 
-
     x = checkData(R)
-    xm = checkData(Rm)
+    xm = checkData(Rm) 
+    x = na.omit(x)
+    xm = na.omit(xm)
+    if(nrow(R) != nrow(Rm)){
+        stop("The length of the return series with the optimal portfolio should be equal")
+    }
+ 
     columnnames = colnames(R)
     columns = ncol(R)
     drawdowns_m = Drawdowns(Rm)

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/man/BenchmarkSR.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/man/BenchmarkSR.Rd	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/man/BenchmarkSR.Rd	2013-09-09 22:33:05 UTC (rev 3039)
@@ -24,6 +24,8 @@
 \examples{
 data(edhec)
 BenchmarkSR(edhec) #expected 0.393797
+data(managers)
+BenchmarkSR(managers) # expected 0.8110536
 }
 \author{
   Pulkit Mehrotra

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/man/MaxDD.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/man/MaxDD.Rd	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/man/MaxDD.Rd	2013-09-09 22:33:05 UTC (rev 3039)
@@ -2,7 +2,8 @@
 \alias{MaxDD}
 \title{Triple Penance Rule}
 \usage{
-  MaxDD(R, confidence, type = c("ar", "normal"), ...)
+  MaxDD(R, confidence = 0.95, type = c("ar", "normal"),
+    ...)
 }
 \arguments{
   \item{R}{Returns}

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/man/MinTrackRecord.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/man/MinTrackRecord.Rd	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/man/MinTrackRecord.Rd	2013-09-09 22:33:05 UTC (rev 3039)
@@ -69,6 +69,9 @@
 MinTrackRecord(edhec[,1],refSR=0.1,Rf = 0.04/12)
 MinTrackRecord(refSR = 1/12^0.5,Rf = 0,p=0.95,sr = 2/12^0.5,sk=-0.72,kr=5.78)
 MinTrackRecord(edhec[,1:2],refSR = c(0.28,0.24))
+
+data(managers)
+MinTrackRecord(managers,refSR = 0)
 }
 \author{
   Pulkit Mehrotra

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/man/ProbSharpeRatio.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/man/ProbSharpeRatio.Rd	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/man/ProbSharpeRatio.Rd	2013-09-09 22:33:05 UTC (rev 3039)
@@ -61,6 +61,9 @@
 ProbSharpeRatio(edhec[,1],refSR = 0.23)
 ProbSharpeRatio(refSR = 1/12^0.5,Rf = 0,p=0.95,sr = 2/12^0.5,sk=-0.72,kr=5.78,n=59)
 ProbSharpeRatio(edhec[,1:2],refSR = c(0.28,0.24))
+
+data(managers)
+ProbSharpeRatio(managers,0)
 }
 \author{
   Pulkit Mehrotra

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/man/REDDCOPS.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/man/REDDCOPS.Rd	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/man/REDDCOPS.Rd	2013-09-09 22:33:05 UTC (rev 3039)
@@ -12,9 +12,6 @@
 
   \item{delta}{Drawdown limit}
 
-  \item{sharpe}{If you want to use a constant Sharpe Ratio
-  please specify here else the return series will be used}
-
   \item{Rf}{risk free rate can be vector such as government
   security rate of return.}
 
@@ -29,6 +26,9 @@
   \item{asset}{The number of risky assets in the portfolio}
 
   \item{type}{The type of portfolio optimization}
+
+  \item{sharpe}{If you want to use a constant Sharpe Ratio
+  please specify here else the return series will be used}
 }
 \description{
   The Rolling Economic Drawdown Controlled Optimal

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/man/TuW.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/man/TuW.Rd	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/man/TuW.Rd	2013-09-09 22:33:05 UTC (rev 3039)
@@ -2,7 +2,7 @@
 \alias{TuW}
 \title{Maximum Time Under Water}
 \usage{
-  TuW(R, confidence, type = c("ar", "normal"), ...)
+  TuW(R, confidence = 0.95, type = c("ar", "normal"), ...)
 }
 \arguments{
   \item{R}{return series}

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/man/chart.BenchmarkSR.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/man/chart.BenchmarkSR.Rd	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/man/chart.BenchmarkSR.Rd	2013-09-09 22:33:05 UTC (rev 3039)
@@ -78,6 +78,9 @@
 data(edhec)
 chart.BenchmarkSR(edhec,vs="strategies")
 chart.BenchmarkSR(edhec,vs="sharpe")
+
+data(managers)
+chart.BenchmarkSR(managers,vs="strategies")
 }
 \author{
   Pulkit Mehrotra

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/man/chart.SRIndifference.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/man/chart.SRIndifference.Rd	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/man/chart.SRIndifference.Rd	2013-09-09 22:33:05 UTC (rev 3039)
@@ -73,6 +73,8 @@
 \examples{
 data(edhec)
 chart.SRIndifference(edhec)
+data(managers)
+chart.SRIndifference(managers)
 }
 \author{
   Pulkit Mehrotra

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/man/golden_section.Rd
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/man/golden_section.Rd	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/man/golden_section.Rd	2013-09-09 22:33:05 UTC (rev 3039)
@@ -2,7 +2,7 @@
 \alias{golden_section}
 \title{Golden Section Algorithm}
 \usage{
-  golden_section(a, b, minimum = TRUE, function_name, ...)
+  golden_section(a, b, function_name, minimum = TRUE, ...)
 }
 \arguments{
   \item{a}{initial point}

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/week1/code/PSROpt.py
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/week1/code/PSROpt.py	2013-09-09 21:31:35 UTC (rev 3038)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/week1/code/PSROpt.py	2013-09-09 22:33:05 UTC (rev 3039)
@@ -133,8 +133,8 @@
 #-------------------------------------------
 def main():
     #1) Inputs (path to csv file with returns series)
-    path='data.csv'
-    maxIter=10000 # Maximum number of iterations
+    path='ham_data.csv'
+    maxIter=1000 # Maximum number of iterations
     delta=.005 # Delta Z (attempted gain per interation)
     
     #2) Load data, set seed



More information about the Returnanalytics-commits mailing list