[Returnanalytics-commits] r3546 - pkg/PerformanceAnalytics/sandbox
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Oct 16 04:16:10 CEST 2014
Author: peter_carl
Date: 2014-10-16 04:16:08 +0200 (Thu, 16 Oct 2014)
New Revision: 3546
Modified:
pkg/PerformanceAnalytics/sandbox/to.period.contributions.R
Log:
- fixed a bug in span calculation
Modified: pkg/PerformanceAnalytics/sandbox/to.period.contributions.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/to.period.contributions.R 2014-10-15 16:09:51 UTC (rev 3545)
+++ pkg/PerformanceAnalytics/sandbox/to.period.contributions.R 2014-10-16 02:16:08 UTC (rev 3546)
@@ -69,11 +69,11 @@
if(i==1){
span = paste0("::", dates[i])
}else{
- span = paste0(dates[i-1], "::", dates[i])
+ span = paste0(dates[i-1]+1, "::", dates[i])
}
period.contrib = rbind(period.contrib, colSums(wgt.contrib[span]/rep(head(lag.cum.ret[span],1),NCOL(wgt.contrib))))
}
- period.contrib = as.xts(period.contrib, order.by = dates)
+ period.contrib = xts(period.contrib, order.by = dates)
period.contrib = cbind(period.contrib, rowSums(period.contrib))
colnames(period.contrib) = c(columnnames, "Portfolio Return")
period.contrib = reclass(period.contrib, x)
More information about the Returnanalytics-commits
mailing list