[R-SIG-Finance] [R-sig-finance] Newbie Question: Portfolio Optimization with MV, LPM and CVaR constraints

Jonathan Ling jon.wanxian at gmail.com
Fri Sep 11 13:59:13 CEST 2009


Hi there,

I'd start of by apologizing if the following has been answered in previous
discussions or materials, so far my searches haven't been resourceful.

I have a project on portfolio optimization to track performances of
portfolios created under different constraints (mean-variance, LPM, VaR and
CVaR). I've used monthly data (for 12 years) for a couple of shares, and I
stumbled on fPortfolio which I've been trying out for the last 2 weeks.

I'm having trouble figuring out a couple of things.

1. Is it possible for fPortfolio to optimize a portfolio constrained by the
VaR?

2. Would it be possible to use the first 10 years of my data to optimize the
portfolios and track performances at 6 months, 1 year and 2 years after
that?

3. I'm having some trouble with the LPM method of optimization. It's
spitting out the error below, but only on monthly data, it works fine with
weekly data.

Here's my codes:

dataset <-read.table("Portfolio1.csv",header=T,sep=",")        
data <- timeSeries(dataset)
data <- returns(data, type = "continuous")

mvspec = portfolioSpec()

lpmspec = portfolioSpec()
setEstimator(lpmspec) <- "lpmEstimator"
setType(lpmspec) <- "QLPM"
lpmspec at model$param$a <- 2
lpmspec at model$param$tau <- "colMeans"

cvarspec = portfolioSpec()
setType(cvarspec) = "CVaR"
setAlpha(cvarspec) = 0.05
setSolver(cvarspec) = "solveRsymphony"

tangencyPortfolio(data, mvspec)

tangencyPortfolio(data, cvarspec)

tangencyPortfolio(data, lpmspec)

which is spitting out the following error:

Execution stopped:
  The maximum ratio portfolio could not be computed.
Possible Reason:
  Your portfolio constraints may be too restrictive.
Status Information:
  status=2 from solver solveRquadprog.
Error: 
  returned from Rmetrics
In addition: There were 15 warnings (use warnings() to see them)

However, it works on weekly data..?

dataset2 <-read.table("weeklydata.csv",header=T,sep=",")
weeklydata <- timeSeries(dataset2)

tangencyPortfolio(weeklydata, lpmspec)


Data
Monthly:  http://www.nabble.com/file/p25398920/Portfolio1.csv Portfolio1.csv 
Weekly:  http://www.nabble.com/file/p25398920/weeklydata.csv weeklydata.csv 


If anyone is able to point me in the right direction, I'd be extremely
grateful! Thanks~
-- 
View this message in context: http://www.nabble.com/Newbie-Question%3A-Portfolio-Optimization-with-MV%2C-LPM-and-CVaR-constraints-tp25398920p25398920.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list