[R-SIG-Finance] fPortfolio, portfolioFrontier, data as mean vector and covariance matrix

John P. Burkett burkett at uri.edu
Fri Jul 25 22:42:52 CEST 2008


The reference manual for the fPortfolio package version 260.72 (February 
16, 2008) states that the data argument of the portfolioFrontier 
function "can be either the mean vector and the covariance matrix in a 
equivalently named list or a time series table" (p. 7). So far I have 
succeeded only with a time series table.  My attempts to use a mean 
vector and covariance matrix elicit error messages.

Discussion of a similar issue in March is archived in Nabble at 
http://www.nabble.com/Direct-Specification-of-Mu-and-Sigma-in-fportfolio-td16392702.html
I wonder whether there is anything new to say now.

As a concrete example of the problem, consider the following code and 
error message:

library(fPortfolio)
returnsdata <- read.csv("realreturns.csv",header=T,sep=",")
attach(returnsdata)
mu <- mean(returnsdata[,2:23]) # unweighted mean returns
Sigma <-  cov(returnsdata[,2:23]) #covariance matrix of returns
lms <- list(mu, Sigma)
Spec = portfolioSpec()
setNFrontierPoints(Spec) = 100
Spec
Constraint = c("minW[1:nAssets]=0")
frontier = portfolioFrontier(lms, Spec, Constraint)
Error: class(data) == "timeSeries" is not TRUE

John

-- 
John P. Burkett
Department of Environmental and Natural Resource Economics
and Department of Economics
University of Rhode Island
Kingston, RI 02881-0808
USA

phone (401) 874-9195



More information about the R-SIG-Finance mailing list