[Returnanalytics-commits] r2418 - in pkg/PerformanceAnalytics/sandbox/pulkit/week1: code tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 24 21:12:11 CEST 2013


Author: pulkit
Date: 2013-06-24 21:12:10 +0200 (Mon, 24 Jun 2013)
New Revision: 2418

Added:
   pkg/PerformanceAnalytics/sandbox/pulkit/week1/tests/SEF.tests.R
Modified:
   pkg/PerformanceAnalytics/sandbox/pulkit/week1/code/MinTRL.R
Log:
Adding unit tests

Modified: pkg/PerformanceAnalytics/sandbox/pulkit/week1/code/MinTRL.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/week1/code/MinTRL.R	2013-06-24 18:48:28 UTC (rev 2417)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/week1/code/MinTRL.R	2013-06-24 19:12:10 UTC (rev 2418)
@@ -63,7 +63,7 @@
     }
     #If weights are not taken into account a message is displayed
     if(is.null(weights)){
-        message("no weights passed,will calculate Probability Sharpe Ratio for each column")
+        message("no weights passed,will calculate Minimum Track Record Length for each column")
     }
    
     if(!is.null(dim(Rf)))

Added: pkg/PerformanceAnalytics/sandbox/pulkit/week1/tests/SEF.tests.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/week1/tests/SEF.tests.R	                        (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/week1/tests/SEF.tests.R	2013-06-24 19:12:10 UTC (rev 2418)
@@ -0,0 +1,11 @@
+library(RUnit)
+library(PerformanceAnalytics)
+data(edhec)
+
+test_PSR<-function(){ 
+ checkEqualsNumeric(ProbSharpeRatio(edhec[,1],refSR = 0.28),0.6275225,tolerance = 1.0e-6)
+}
+
+test_MinTRL<-function(){  
+  checkEqualsNumeric(MinTrackRecord(edhec[,1],refSR=0.28),3861.706,tolerance = 1.0e-3)
+}



More information about the Returnanalytics-commits mailing list