[Returnanalytics-commits] r2389 - pkg/PerformanceAnalytics/sandbox/pulkit

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 20 18:14:09 CEST 2013


Author: pulkit
Date: 2013-06-20 18:14:08 +0200 (Thu, 20 Jun 2013)
New Revision: 2389

Modified:
   pkg/PerformanceAnalytics/sandbox/pulkit/PSRopt.R
Log:
error in checkbounds

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/PSRopt.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/PSRopt.R	2013-06-20 07:47:54 UTC (rev 2388)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/PSRopt.R	2013-06-20 16:14:08 UTC (rev 2389)
@@ -47,11 +47,11 @@
     # To Check the bounds of the weights
     checkBounds<-function(weights){
         flag = TRUE
-        #for(i in 1:columns){
-         #   if(weights[i] < bounds[i,0]) flag = FALSE
+        for(i in 1:columns){
+            if(weights[i] < bounds[i,1]) flag = FALSE
 
-          #  if(weights[i] > bounds[i,1]) flag = FALSE
-        #}
+            if(weights[i] > bounds[i,1]) flag = FALSE
+        }
         return(TRUE)
     }
 
@@ -60,7 +60,7 @@
         if(length(which(d1Z!=0)) == 0){
             return(NULL)        
         }
-        weights[which(abs(d1Z)==max(abs(d1Z)))] = weights[which(abs(d1Z)==max(abs(d1Z)))]+delta/max(d1Z)
+        weights[which(abs(d1Z)==max(abs(d1Z)))] = weights[which(abs(d1Z)==max(abs(d1Z)))]+delta/d1Z[which(abs(d1Z)==max(abs(d1Z)))]
         # OR all the weights should be changed ?
         #weights = weights + delta/d1Z
         weights = weights/sum(weights)



More information about the Returnanalytics-commits mailing list