Dear Rmetrics team,

I've been looking through the fPortfolio source code and examples and searching online for a few days, but I haven't found an answer.

In the code below (fPortfolio Version 2110.79, R 2.11.1), if min weights below (min.weights <- c(rep(0, 5), 0.2)) are 0, portfolioFrontier returns no errors.  But when, for example, mean weights increase (min.weights <- c(rep(0, 5), 0.2)), portfolioFrontier returns:

Execution stopped:
  The minimum risk portfolio could not be computed.
Possible Reason:
  Your portfolio constraints may be too restrictive.

It seems that the minvariancePortfolio function attempts to minimize risk subject to a return constraint that is not feasible (because it is simply set to the smallest mu).

Is there a way to modify this code, so it runs without errors?  Any help would be much appreciated.


library(fPortfolio)
x <- SMALLCAP.RET[,1:6]
spec <- portfolioSpec()
setNFrontierPoints(spec) <- 50
assets.num <- 1:ncol(x)
min.weights <- c(rep(0.1, 5), 0.2)
constraints.min <- paste("minW[", assets.num, "]=", min.weights, sep = "")
max.weights <- c(rep(1, 5), 0.4)
constraints.max <- paste("maxW[", assets.num, "]=", max.weights, sep = "")
constraints <- c(constraints.min, constraints.max)
frontier <- portfolioFrontier(x, spec = spec, constraints = constraints)


Maciej Ombach


----------------------------------------------------------------------
This message w/attachments (message) is intended solely ...{{dropped:10}}

