J'ai ci-dessous script qui crée une erreur. Quelqu'un sait-il comment résoudre ceci. Je cours la dernière version de R & RStudio, et tous les paquets sont à jour.PortfolioAnalytics Erreur avec la fonction gmv_opt
library('quantmod')
library('PortfolioAnalytics')
library('PerformanceAnalytics')
ETF_Names <- c("IVV","IJH","IWM","EZU","EEM","SCZ","ILF","EPP")
ETF_All <- lapply(ETF_Names, function(x) getSymbols(x,from="2006-01-01",auto.assign = FALSE))
names(ETF_All) <- ETF_Names
ETF_MR <- do.call(merge,lapply(ETF_All,monthlyReturn))
colnames(ETF_MR) <- ETF_Names
ETF_spec <- portfolio.spec(assets = colnames(ETF_MR))
ETF_spec <- add.constraint(portfolio=ETF_spec, type="full_investment")
ETF_spec <- add.constraint(portfolio=ETF_spec, type="box", min=0, max=1)
ETF.ef <- create.EfficientFrontier(R=ETF_MR['2015'], portfolio=ETF_spec, type="mean-StdDev")
Ci-dessous le message d'erreur:
Error in gmv_opt(R = R, constraints = constraints, moments = moments, :
No solution found: Error in UseMethod("as.constraint") :
no applicable method for 'as.constraint' applied to an object of class "c('matrix', 'list')"
Il n'y a jamais eu des problèmes avant (je viens rstudio récemment mis à jour et les paquets concernés). Et c'est quand l'erreur a surgi.
J'espère que quelqu'un peut aider