# Calculate efficient frontier using fPortfolio with incomplete set of returns

I want to calculate the efficient frontier for a set of 140 assets using returns from the past 10 years. However, some of these assets came into existence only more recently, so for some assets I have the returns for the full 10 years, but for others I have returns only e.g. the last 3 years.

I can calculate the efficient frontier (as described in http://www.finance-r.com/s/efficient_frontier_fPortfolio/complete/ ) if I use the tail of the returns for which all returns are available. But I'd like to use the the full set of returns, where available.

Currently fPortfolio throws an exception when I input a dataset with NAs. How would I reach my goal? I suspect I'd have to tinker with the fPortfolio source.

I am not a particularly big fan of fPortfolio. My first thought was to estimate a mean and covariance matrix accounting for the missing data (should be discussed several times on this site or other places) and pass that. However, looking at the manual, it looks like the relevant functions only take time series data. Based on that limitation, you have a few options

1. Get the fPortfolio source and re-write the relevant functions to take a mean and covariance
2. Write your own portfolio optimization function doing the same thing as #1. Not really that hard.
3. A more sophisticated approach might be to use multiple imputation. In this case, you'd simulate missing data for your time series and then pass the complete dataset to the fPortfolio function. Repeat this many times and take an average of the weights (following some burn-in).
• Thanks, so it's what I expected. I'm going to dive into the fPortfolio source code and hopefully contribute. – Francois Botha Mar 31 '15 at 8:14

You might take a look at the PortfolioAnalytics package. It's optimize.portfolio function does require asset returns but the momentFUN argument allows you to provide your own function for using these returns to calculate the moments used in the optimization. Overall it provides a great deal of flexibility for specifying constraints and optimization methods. It's not on CRAN but is available from Return Analytics Development Page .