CVaR的产品组合优化无法在fPortfolio包中使用

时间:2014-11-15 11:18:11

标签: r optimization portfolio

我正在尝试复制书籍示例,如下面的答案:

https://quant.stackexchange.com/a/3937

但是我收到了这个错误:

  

frontier< - portfolioFrontier(data = lppData,spec = frontierSpec,constraints =" LongOnly");

get中的错误(as.character(FUN),mode =" function",envir = envir):   对象' solveRglpk'模式'功能'找不到

我试图解决调用库(" Rglpk"),错误仍在继续。

任何帮助将不胜感激。 罗伯特

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

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

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

other attached packages:
[1] fPortfolio_3011.81 fAssets_3011.83    fBasics_3011.87    timeSeries_3011.98
[5] timeDate_3011.99  

loaded via a namespace (and not attached):
 [1] boot_1.3-13       DEoptimR_1.0-2    ecodist_1.2.9     energy_1.6.2     
 [5] fCopulae_3011.81  fMultivar_3011.78 kernlab_0.9-19    MASS_7.3-35      
 [9] mnormt_1.5-1      mvnormtest_0.1-9  numDeriv_2012.9-1 parallel_3.1.2   
[13] quadprog_1.5-5    RCurl_1.95-4.3    Rglpk_0.6-0       rneos_0.2-7      
[17] robustbase_0.91-1 Rsolnp_1.14       Rsymphony_0.1-17  slam_0.1-32      
[21] sn_1.1-1          stats4_3.1.2      truncnorm_1.0-7   XML_3.98-1.1  

1 个答案:

答案 0 :(得分:0)

solveRglpk.CVAR(data, spec, constraints)
solveRglpk.MAD(data, spec, constraints)
solveRampl.CVAR(data, spec, constraints)

设置优化算法

setSolver(frontierSpec)  <- "solveRglpk.CVAR"

尝试使用其中一个。不解决Rampl()