最近我在R:
中使用了fPortfoliogroup.1 = c("minsumW[ sec1 ] = 0.215688 " , "maxsumW[ sec1 ] = 0.3126 " )
groupConstraints = c(group.1)
portfolioConstraints(ret, mv, groupConstraints)
如果我如上所述,它运作良好。
但是如果我从矩阵中设置约束数:
group.1 = c("minsumW[ sec1 ] = lobound[1]" , "maxsumW[ sec1 ] = 0.3126 " )
groupConstraints = c(group.1)
portfolioConstraints(ret, mv, groupConstraints)
它不起作用。
警告讯息:
强制引入的NAs
我该如何解决?
答案 0 :(得分:1)
尝试
c(粘贴(“minsumW [sec1] =”,lobound [1],sep =“”),“maxsumW [sec1] = 0.3126”)