[Returnanalytics-commits] error with Return.rebalancing after upgrading to latest stable PerformanceAnalytics v1.1.0

Brian G. Peterson brian at braverock.com
Fri Aug 9 16:47:53 CEST 2013


On 08/09/2013 09:14 AM, Paolo Cavatore wrote:
>>Return.rebalancing(testRet,testWeights)
> Error in `[.xts`(result, 2:length(result)) : subscript out of bounds
>
> Can you advise?

Your example works for me with current code.

I suggest updating xts.  xts was updated on CRAN recently to solve a 
likely related problem to the one you report.

In the future, please email the maintainer(s) directly, and don't email 
the SVN commits list.  This list is for monitoring the source commit 
system, not discussing things.


Regards,

Brian

Ref:

require(PerformanceAnalytics)

testRet <- xts(cbind(c(0.10,-0.08,0.15), c(0.02,0.01,-0.01)), 
order.by=as.Date(c("2013-07-19","2013-07-26","2013-08-02")) )

names(testRet) <- c("equity", "bond")

testWeights <- xts(cbind(c(0.2,0.3), c(0.8,0.7)), 
order.by=as.Date(c("2013-07-19","2013-07-26")) )

names(testWeights) <- c("equity", "bond")

Return.rebalancing(testRet,testWeights)

sessionInfo()

####################
 > Return.rebalancing(testRet,testWeights)
            portfolio.returns
2013-07-26            -0.008
2013-08-02             0.038
 > sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=C                 LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] PerformanceAnalytics_1.1.0 xts_0.9-5
[3] zoo_1.7-10

loaded via a namespace (and not attached):
[1] grid_3.0.1      lattice_0.20-15

#######################


-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock


More information about the Returnanalytics-commits mailing list