install.packages(" FRAPO&#34)
install.packages(" quantmod&#34)
库(FRAPO)
库(quantmod)
startDate< - " 2006-01-01"
endDate< - " 2015-12-31"
symbols = c("XLF", "XLP", "XLE", "XLY", "XLV", "XLI", "XLB", "XLK", "XLU")
getSymbols(symbols, src="yahoo", from=startDate, to=endDate)
price.data<-cbind(XLY[,6],XLP[,6],XLE[,6],XLF[,6],XLV[,6],XLI[,6],XLB[,6],XLK[,6], XLU[,6])
colnames(price.data)<-c("Consumer Discretionary", "Consumer Staples", "Energy",
"Financial", "Health Care", "Industrial", "Materials",
"Technology", "Utilities")
names<-c("Consumer Discretionary", "Consumer Staples", "Energy",
"Financial", "Health Care", "Industrial", "Materials",
"Technology", "Utilities")
mcdd<-PMinCDaR(price.data, alpha = 0.95, softBudget = FALSE)
round(mcdd@weights, digits=8)
我得到了:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘returnseries’ for signature ‘"xts"’
我想使用S&amp; P 500时间序列来检查(PMinCDaR)投资组合优化,以确定S&amp; P500风险的最小条件下降。但是当我尝试使用PMinCDaR时,我得到错误:in(function(classes,fdef,mtable):无法找到函数'returnseries'的签名'&#34; xts&#34;'
的继承方法