[R-SIG-Finance] portfolioFrontier nonsense

ssmith88 at umd.edu ssmith88 at umd.edu
Sat Jun 13 00:14:27 CEST 2009


I'm attempting a very basic optimization with fPortfolio using the default constraints.  Yet, the portfolio frontier that is generated is nonsense.  As the return increases, the risk decreases!  Any help would be greatly appreciated.  Below is my code:



library(fPortfolio)
#Gets date,price, and return data from excel spreadsheet
#------------------------------------------------------------
sp500Reuters<-read.csv("C:\\data\\sp500Reuters.csv")
spgsciReuters<-read.csv("C:\\data\\spgsciReuters.csv")
msciWorldReuters<-read.csv("C:\\data\\msciWorldReuters.csv")
cshfReuters<-read.csv("C:\\data\\cshfReuters.csv")

# Creates return Matrix, timeDate object, and timeSeries object
#------------------------------------------------------------
returnMatrix<-cbind(sp500Reuters[(2:185),3],msciWorldReuters[(2:185),3],spgsciReuters[(2:185),3],cshfReuters[(2:185),3])
colNames<-c("US Equity","World Equity","Commodities","Hedge Fund")
colnames(returnMatrix)<-colNames
returnSeries<-as.timeSeries(returnMatrix)
timeObject<-timeSequence(from="1994-1-31",to="2009-4-30",by="month",format="%Y-%m-%d",FinCenter="GMT")
dataSet<-timeSeries(returnSeries,timeObject,units=NULL,format=NULL,zone="GMT",FinCenter="GMT")
------------------------------------------------------------
# Creates portfolioData object and generates frontier
portfolioData<-portfolioData(dataSet,spec=portfolioSpec())
newFrontier<-portfolioFrontier(portfolioData)

#Note that I've also tried 
newFrontier<-portfolioFrontier(dataSet)

In both cases I get an output such as the following:

Target Return and Risks:
     mean     mu    Cov  Sigma   CVaR    VaR
1  0.0380 0.0380 0.5285 0.5285 1.3375 0.9721
13 0.0500 0.0500 0.4391 0.4391 1.0920 0.7691
25 0.0620 0.0620 0.3609 0.3609 0.8590 0.5488
37 0.0740 0.0740 0.3014 0.3014 0.6797 0.3874
50 0.0869 0.0869 0.2732 0.2732 0.6036 0.4280


Thanks for any help in advance.



More information about the R-SIG-Finance mailing list