Michael Ashton
2010-Jan-21 16:48 UTC
[Rd] fPortfolio prob: maxreturnPortfolio() returns Na/NaN/Inf error
Hi - First posting here. I am using fPortfolio to try and optimize a simple portfolio consisting of 5 daily return series. I want to maximize return subject to setTargetRisk(myspec)=0.08 using only constraints="LongOnly" I can run feasiblePortfolio() using a spec file that specifies the weights, and it works fine. When I run maxreturnPortfolio(mydata,myspec,"LongOnly"), however, I get Error in .rquadprog(Dmat = args$Dmat, dvec = args$dvec, Amat = args$Amat, : NA/NaN/Inf in foreign function call (arg 8) Troubleshooting, it appears to be occurring in the routine eqsumWConstraints within .rquadprogArguments. Specifically, when that routine calls ceq <- c(Return = targetReturn, Budget = -1) it produces> ceqReturn Budget NA -1 And that NA causes .rquadprog to spew, I think, when it reaches the line optim = .Fortran("qpgen2", as.double(Dmat), dvec = as.double(dvec), as.integer(n), as.integer(n), sol = as.double(rep(0, n)), crval = as.double(0), as.double(Amat), as.double(bvec), as.integer(n), as.integer(q), as.integer(meq), iact = as.integer(rep(0, q)), nact = as.integer(0), iter = as.integer(rep(0, 2)), work = as.double(work), ierr = as.integer(0), PACKAGE = "quadprog") ...where I have highlighted the offending argument (8). Now, there is nothing unusual that I can see about my data. Unfortunately with the .Fortran I don't think I can troubleshoot any further. I am hoping someone here has a clue... Thanks in advance. Mike Ashton ________________________________ This email and any attachments are confidential and inte...{{dropped:10}}