[Returnanalytics-commits] r3662 - in pkg/PerformanceAnalytics: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jun 7 02:59:54 CEST 2015


Author: braverock
Date: 2015-06-07 02:59:53 +0200 (Sun, 07 Jun 2015)
New Revision: 3662

Modified:
   pkg/PerformanceAnalytics/DESCRIPTION
   pkg/PerformanceAnalytics/R/CAPM.dynamic.R
   pkg/PerformanceAnalytics/R/Return.Geltner.R
   pkg/PerformanceAnalytics/R/Return.calculate.R
Log:
- use lag.xts to work around shockingly bad dispatch behavior by dplyr reported by Roger Bos


Modified: pkg/PerformanceAnalytics/DESCRIPTION
===================================================================
--- pkg/PerformanceAnalytics/DESCRIPTION	2015-06-04 00:09:54 UTC (rev 3661)
+++ pkg/PerformanceAnalytics/DESCRIPTION	2015-06-07 00:59:53 UTC (rev 3662)
@@ -12,7 +12,7 @@
   , person(given="Kyle",family="Balkissoon",role="ctb")  
   , person(given="Diethelm",family="Wuertz",role="ctb")  
   )
-Version: 1.4.3640
+Version: 1.4.3662
 Date: $Date$
 Description: Collection of econometric functions for
     performance and risk analysis. This package aims to aid

Modified: pkg/PerformanceAnalytics/R/CAPM.dynamic.R
===================================================================
--- pkg/PerformanceAnalytics/R/CAPM.dynamic.R	2015-06-04 00:09:54 UTC (rev 3661)
+++ pkg/PerformanceAnalytics/R/CAPM.dynamic.R	2015-06-07 00:59:53 UTC (rev 3662)
@@ -78,10 +78,10 @@
     xRb = Return.excess(Rb, Rf)[1:(nrow(Rb) - 1)]
     z = Z - matrix(rep(mean(Z), nrow(Z)), nrow(Z), ncol(Z), byrow = TRUE)
     # Construct the matrix with information regressors (lagged values)
-    inform = lag(z)
+    inform = lag.xts(z)
     if (lags > 1){
       for (i in 2:lags) {
-        inform = cbind(inform, lag(z, i))
+        inform = cbind(inform, lag.xts(z, i))
       }
     }
     z = inform[(lags + 1):nrow(z), ]

Modified: pkg/PerformanceAnalytics/R/Return.Geltner.R
===================================================================
--- pkg/PerformanceAnalytics/R/Return.Geltner.R	2015-06-04 00:09:54 UTC (rev 3661)
+++ pkg/PerformanceAnalytics/R/Return.Geltner.R	2015-06-07 00:59:53 UTC (rev 3662)
@@ -58,7 +58,7 @@
 
     clean.geltner <- function(column.R) {
         # compute the lagged return series
-        lagR = lag(column.R, k=1)
+        lagR = lag.xts(column.R, k=1)
         # compute the first order autocorrelation
         f_acf = as.numeric(acf(as.numeric(column.R), plot = FALSE)[1][[1]])
         # now calculate and return the Geltner series

Modified: pkg/PerformanceAnalytics/R/Return.calculate.R
===================================================================
--- pkg/PerformanceAnalytics/R/Return.calculate.R	2015-06-04 00:09:54 UTC (rev 3661)
+++ pkg/PerformanceAnalytics/R/Return.calculate.R	2015-06-07 00:59:53 UTC (rev 3662)
@@ -70,7 +70,7 @@
 
     if(method=="simple" || method=='discrete'){
         #Returns = pr/pr[-nrow(pr), ] - 1
-        Returns = pr/lag(pr) - 1
+        Returns = pr/lag.xts(pr) - 1
         xtsAttributes(Returns) <- list(ret_type="discrete")
     }
     if(method=="compound" || method=='log') {



More information about the Returnanalytics-commits mailing list