我正在尝试使用投资组合分析库来创建和优化投资组合
第一步是创建投资组合规范
port_spec.minES <- add.objective(portfolio=port_spec, type="risk", name="ES", arguments=list(p=0.925, clean="boudt"))
比我运行优化器
opt_minES <- optimize.portfolio(asset_returns, portfolio = port_spec.minES, optimize_method = "ROI",trace=TRUE )
但是我收到了这个错误
clean.boudt(na.omit(R[, column, drop = FALSE]), alpha = alpha, 中的错误:requireNamespace("robustbase", quiet = TRUE) 不是 TRUE
这是回溯
5.stop(simpleError(msg, call = if (p <- sys.parent(1L)) sys.call(p)))
4.stopifnot(requireNamespace("robustbase", quiet = TRUE))
3.clean.boudt(na.omit(R[, column, drop = FALSE]), alpha = alpha, ...)
2.Return.clean(R = R,方法=清洁)
1.optimize.portfolio(asset_returns,portfolio = port_spec.RiskBudgetES,optimize_method = “ROI”,trace = TRUE)