[R-SIG-Finance] fPortfolio and maxreturnPortfolio

pierrelequeux pierre at lequeux.org
Mon Jun 16 11:00:10 CEST 2014


I am trying to use the maxreturnPortfolio  to maximise the return of a
multiasset portfolio for a given level of risk. Somehow I do not seem to be
able to produce any result with it. As anyone used this before and could
give me a sample code on how to use it. basically I have a matrix of etf and
try to generate a portfolio for 10% target risk. my code is as follows:


rm(list=ls(all=TRUE))

library(quantmod)
library(PerformanceAnalytics)
require(fPortfolio)

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 <-  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')
datamatrix <- as.xts(datamatrix)
Spec <- portfolioSpec()
setTargetRisk(Spec)  <- 0.10
maxreturnPortfolio(as.timeSeries(datamatrix),spec=Spec,constraints="LongOnly")




Whatever the risk target I set I get zero weights for all of the assets.
What  I get from my R session is as below. :

Title:
 MV Return Maximized Efficient Portfolio 
 Estimator:         covEstimator 
 Solver:            solveRquadprog 
 Optimize:          maxReturn 
 Constraints:       LongOnly 

Portfolio Weights:
      Global Equities Ex US                 US Equities     Emerging Markets
Stocks                       REITs 
                          0                           0                          
0                           0 
        Treasuries 15 - 30Y            Treasuries 5-10Y            
Treasuries 1-4Y US Inflation Linked 7 - 20Y 
                          0                           0                          
0                           0 

Covariance Risk Budgets:
      Global Equities Ex US                 US Equities     Emerging Markets
Stocks                       REITs 
                                                                                                                
        Treasuries 15 - 30Y            Treasuries 5-10Y            
Treasuries 1-4Y US Inflation Linked 7 - 20Y 
                                                                                                                

Target Return and Risks:
 mean    mu   Cov Sigma  CVaR   VaR 
    0     0     0     0     0     0 

Description:
 Mon Jun 16 09:56:39 2014 by user: Pierre 





Any help appreciated.



--
View this message in context: http://r.789695.n4.nabble.com/fPortfolio-and-maxreturnPortfolio-tp4692180.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list