无法使用随机生成的xts调用table.CalendarReturns

时间:2014-11-24 01:34:54

标签: r performanceanalytics

我使用PerformanceAnalytics::table.CalendarReturns生成随机生成的xts日历返回表。

library("xts")
library("PerformanceAnalytics")
set.seed(0)
n <- 150
data <- xts(100 + cumsum(rnorm(n, 0.03, 0.1)), Sys.Date() + (1:n))
ret <- Return.calculate(data,"log")
PerformanceAnalytics::table.CalendarReturns(ret)

对于此代码,我收到以下错误:

Error in matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow = nr,  : 
  'data' must be of a vector type, was 'NULL'

R和所有包都是更新的。以下是我的会话信息:

R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] PerformanceAnalytics_1.4.3541 xts_0.9-7                     zoo_1.7-11                   

loaded via a namespace (and not attached):
[1] grid_3.1.2      lattice_0.20-29 tools_3.1.2    

0 个答案:

没有答案