Reputation: 21
I am trying to use the Portfolio analytics library to create and optimize a portfolio
The first step is to create the portfolio specification
port_spec.minES <- add.objective(portfolio=port_spec, type="risk", name="ES", arguments=list(p=0.925, clean="boudt"))
Than I am running the optimizer
opt_minES <- optimize.portfolio(asset_returns, portfolio = port_spec.minES, optimize_method = "ROI",trace=TRUE )
However I got this error
Error in clean.boudt(na.omit(R[, column, drop = FALSE]), alpha = alpha, : requireNamespace("robustbase", quietly = TRUE) is not TRUE
This is the traceback
5.stop(simpleError(msg, call = if (p <- sys.parent(1L)) sys.call(p)))
4.stopifnot(requireNamespace("robustbase", quietly = TRUE))
3.clean.boudt(na.omit(R[, column, drop = FALSE]), alpha = alpha, ...)
2.Return.clean(R = R, method = clean)
1.optimize.portfolio(asset_returns, portfolio = port_spec.RiskBudgetES, optimize_method = "ROI", trace = TRUE)
Upvotes: 0
Views: 343
Reputation: 1493
It seems that package robustbase
is not available. You'll need to install it:
install.packages("robustbase")
Upvotes: 1