[Returnanalytics-commits] r2953 - pkg/PortfolioAnalytics/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Aug 31 20:19:26 CEST 2013
Author: rossbennett34
Date: 2013-08-31 20:19:25 +0200 (Sat, 31 Aug 2013)
New Revision: 2953
Modified:
pkg/PortfolioAnalytics/R/optFUN.R
pkg/PortfolioAnalytics/R/optimize.portfolio.R
Log:
Fixing case with optimize.portfolio where the moment function was failing if no dot args were passed in. Removing print statements from gmv_opt.
Modified: pkg/PortfolioAnalytics/R/optFUN.R
===================================================================
--- pkg/PortfolioAnalytics/R/optFUN.R 2013-08-31 16:30:59 UTC (rev 2952)
+++ pkg/PortfolioAnalytics/R/optFUN.R 2013-08-31 18:19:25 UTC (rev 2953)
@@ -58,8 +58,6 @@
rhs.vec <- c(rhs.vec, constraints$lower, -constraints$upper)
}
- print(constraints$conc_aversion)
- print(lambda_hhi)
# set up the quadratic objective
if(!is.null(constraints$conc_aversion)){
ROI_objective <- Q_objective(Q=2*lambda*moments$var + lambda_hhi * diag(N), L=-moments$mean)
Modified: pkg/PortfolioAnalytics/R/optimize.portfolio.R
===================================================================
--- pkg/PortfolioAnalytics/R/optimize.portfolio.R 2013-08-31 16:30:59 UTC (rev 2952)
+++ pkg/PortfolioAnalytics/R/optimize.portfolio.R 2013-08-31 18:19:25 UTC (rev 2953)
@@ -515,7 +515,10 @@
.formals$R <- R
.formals$portfolio <- portfolio
.formals$... <- NULL
-
+
+ # If no dotargs are passed in, .formals was a pairlist and do.call was failing
+ if(!inherits(.formals, "list")) .formals <- as.list(.formals)
+
mout <- try((do.call(momentFUN, .formals)) ,silent=TRUE)
if(inherits(mout,"try-error")) {
message(paste("portfolio moment function failed with message",mout))
More information about the Returnanalytics-commits
mailing list