[Returnanalytics-commits] r2601 - pkg/PerformanceAnalytics/sandbox/pulkit/week5

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 19 15:34:23 CEST 2013


Author: pulkit
Date: 2013-07-19 15:34:23 +0200 (Fri, 19 Jul 2013)
New Revision: 2601

Added:
   pkg/PerformanceAnalytics/sandbox/pulkit/week5/chart.REDD.R
Modified:
   pkg/PerformanceAnalytics/sandbox/pulkit/week5/redd.R
Log:
REDD

Added: pkg/PerformanceAnalytics/sandbox/pulkit/week5/chart.REDD.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/week5/chart.REDD.R	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/week5/chart.REDD.R	2013-07-19 13:34:23 UTC (rev 2601)
@@ -0,0 +1,16 @@
+chart.REDD<-function(R,rf,h, geometric = TRUE,legend.loc = NULL, colorset = (1:12),...)
+{
+#DESCRIPTION:
+#A function to create the chart for the rolling economic drawdown
+#
+  # calculates the Rolling Economic Drawdown(REDD) for
+  # a return series.To calculate the rolling economic drawdown cumulative 
+  # return and rolling economic max is calculated for each point. The risk 
+  # free return(rf) and the lookback period(h) is taken as the input.
+ 
+
+    rolldrawdown = rollDrawdown(R,geometric = TRUE,weights = NULL,rf,h)
+    chart.TimeSeries(rolldrawdown, colorset = colorset, legend.loc = legend.loc, ...)
+}
+
+

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/week5/redd.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/week5/redd.R	2013-07-19 11:40:26 UTC (rev 2600)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/week5/redd.R	2013-07-19 13:34:23 UTC (rev 2601)
@@ -32,11 +32,10 @@
     columnnames = colnames(x)
     rf = checkData(rf)
     rowr = nrow(rf)
-    if(rowr != 1 ){
-        if(rowr != rowx){
+    if(rowr != 1 && rowr != rowx ){
             warning("The number of rows of the returns and the risk free rate do not match")
         }
-    }
+    
     REDD<-function(x,geometric){
         if(geometric)
             Return.cumulative = cumprod(1+x)
@@ -56,20 +55,7 @@
     rolldrawdown = reclass(rolldrawdown, x)
     return(rolldrawdown)
 }
-chart.REDD<-function(R,rf,h, geometric = TRUE,legend.loc = NULL, colorset = (1:12),...)
-{
-#DESCRIPTION:
-#A function to create the chart for the rolling economic drawdown
-#
-  # calculates the Rolling Economic Drawdown(REDD) for
-  # a return series.To calculate the rolling economic drawdown cumulative 
-  # return and rolling economic max is calculated for each point. The risk 
-  # free return(rf) and the lookback period(h) is taken as the input.
- 
 
-    rolldrawdown = rollDrawdown(R,geometric = TRUE,weights = NULL,rf,h)
-    chart.TimeSeries(rolldrawdown, colorset = colorset, legend.loc = legend.loc, ...)
-}
 
 
 
@@ -78,8 +64,6 @@
 
 
 
-
-
   
 
 



More information about the Returnanalytics-commits mailing list