 

I am working on a small allocation project and have tried to used the
maxreturnPortfolio function in the fPortfolio package to find the portfolio
that maximise return for a specified level of risk, However the function
does not seem to work. It returns zero weights independently of the  level
of risk provided as the target. Has anyone had experience of working with
that function or could provide an alternative code ?

 

 

require(timeseries)

require(fPortfolio)

require(quantmod)

 

ETF <-  c('VGSIX','VUSTX','VGTSX','VFISX','VTSMX','VFITX','VEIEX','VIPSX')

getSymbols(ETF,source = 'yahoo')

datamat <-
as.xts(cbind(get("VGTSX")[,4],get("VTSMX")[,4],get("VEIEX")[,4],get("VGSIX")
[,4],get("VUSTX")[,4],get("VFITX")[,4],get("VFISX")[,4],get("VIPSX")[,4]))

datamatrix <-  as.xts(apply(datamat,2,function(x) diff(log(x))))

colnames(datamatrix) <-  c('Global Equities Ex US','US Equities','Emerging
Markets Stocks',"REITs",'Treasuries 15 - 30Y','Treasuries 5-10Y','Treasuries
1-4Y','US Inflation Linked 7 - 20Y')

 

x <- timeSeries(datamatrix, charvec=as.Date(index(datamatrix)))

Constraints <-  "LongOnly"

Spec  <- portfolioSpec()

setTargetRisk(Spec) <- 0.1

getWeights(maxreturnPortfolio(x, Spec, Constraints)@portfolio)

 

 

 

VGTSX.Close VTSMX.Close VEIEX.Close VGSIX.Close VUSTX.Close VFITX.Close
VFISX.Close VIPSX.Close 

          0           0           0           0           0           0
0           0 

 

 

 

Any help appreciated


	[[alternative HTML version deleted]]

