[Returnanalytics-commits] r2313 - pkg/PerformanceAnalytics/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 23 21:24:44 CET 2013


Author: peter_carl
Date: 2013-01-23 21:24:43 +0100 (Wed, 23 Jan 2013)
New Revision: 2313

Modified:
   pkg/PerformanceAnalytics/R/KellyRatio.R
Log:
- changed apply to sapply to pass xts objects into Return.excess
- changed sd.xts to StdDev


Modified: pkg/PerformanceAnalytics/R/KellyRatio.R
===================================================================
--- pkg/PerformanceAnalytics/R/KellyRatio.R	2013-01-23 20:19:25 UTC (rev 2312)
+++ pkg/PerformanceAnalytics/R/KellyRatio.R	2013-01-23 20:24:43 UTC (rev 2313)
@@ -57,14 +57,14 @@
     kr <- function (R, Rf, method)
     {
         xR = Return.excess(R, Rf)
-        KR =  mean(xR, na.rm=TRUE)/sd.xts(R, na.rm=TRUE)^2
+        KR =  mean(xR, na.rm=TRUE)/StdDev(R, na.rm=TRUE)^2
         if (method == "half") {
             KR = KR/2
         }
         return(KR)
     }
 
-    result = apply(R, 2, kr, Rf = Rf, method = method)
+    result = sapply(R, kr, Rf = Rf, method = method)
     dim(result) = c(1,NCOL(R))
     colnames(result) = colnames(R)
     rownames(result) = "Kelly Ratio"



More information about the Returnanalytics-commits mailing list