[R-SIG-Finance] Help with portfolioData/fPortfolio?

matt at considine.net matt at considine.net
Fri Jan 27 21:29:10 CET 2012


I am trying to run some Rmetrics code (e.g. feasiblePortfolio,  
frontierPortfolio) using data that is already set up as expected  
returns and a variance/covariance matrix.

The fPortfolio documentation suggests that the "data" argument to  
portfolioData
is

"a time series or a named list, containing either a series of returns or named
entries ?mu? and ?Sigma? being mean and covariance matrix."

Yet when I try to run this on code like this (example in mail archives) :
  #install.packages("MBESS") #for cor2cov
  mu <- c( 0.1, 0.08, 0.065)
  sigma <- c( 0.18, 0.12, 0.09 )

  correlationMatrix <- rbind( c( 1, 0.8, 0.9 ),
                              c( 0.8, 1, 0.75),
                              c( 0.9, 0.75, 1) )

  covarianceMatrix <- cor2cov(correlationMatrix, sigma )

  data = list( mu = mu, Sigma = covarianceMatrix )
  frontier<-portfolioFrontier(data)

I get the message
   Error: class(data) == "timeSeries" is not TRUE

Now obviously I know what the error message means.  But it suggests  
that I am overlooking something such as a parameter or that the doc is  
wrong.  Further down in the documentation there is a description of  
this dataset

Simulated Mean-Cov Data Set:
This data is taken from chapter 1.3.2 in Scherer, M., Martin, R.D.  
(2005); Introduction To Modern Portfolio Optimization with NuOPT,  
S-PLUS and S+Bayes, Springer, Berlin. It is a list of covariance  
matrix and the return means of imaginary assets. It is an example set  
for learning about optimization.

which suggests to mean that I am missing something.

Can anyone tell me
   a) can I run the Rmetrics codes above using mu and Sigma and if so  
what parameters do I need to use or what do I need to do differently?
   b) where can I find the "Simulated Mean-Cov" dataset so that I can  
play with it and otherwise see if I have misformatted my inputs?  Is  
there an example available that I can be pointed to which would show  
how it is used (and which would presumably answer question (a)?

Thank you in advance for any advice, pointers, code, etc.  And  
patience - most of all!

Regards,
Matt Considine



More information about the R-SIG-Finance mailing list