Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 利用绩效分析进行投资组合再平衡_R_Performanceanalytics - Fatal编程技术网

R 利用绩效分析进行投资组合再平衡

R 利用绩效分析进行投资组合再平衡,r,performanceanalytics,R,Performanceanalytics,我正在尝试使用PerformanceAnalytics通过每日重新平衡来回溯测试一些投资组合的表现。下面是一个虚拟示例: ret <- xts(matrix(rnorm(20, 0, 0.01), nrow = 10), as.Date(1:10)) weights <- runif(10) weights <- xts(cbind(weights, 1 - weights), as.Date(1:10)) names(ret) <- c('a', 'b') n

我正在尝试使用PerformanceAnalytics通过每日重新平衡来回溯测试一些投资组合的表现。下面是一个虚拟示例:

ret     <- xts(matrix(rnorm(20, 0, 0.01), nrow = 10), as.Date(1:10))
weights <- runif(10)
weights <- xts(cbind(weights, 1 - weights), as.Date(1:10))

names(ret) <- c('a', 'b')
names(weights) <- names(ret)

Return.rebalancing(ret, weights)

ret已报告:并在R-Forge上修复。谢谢。我安装了最新版本,它可以正常工作。@JoshuaUlrich:出于某种原因,返回。重新平衡速度惊人地慢。在速度非常快的计算机上使用上述代码2000天需要4.5秒,而在coredata上使用乘法几乎不需要时间。这是预期的吗?