[R-SIG-Finance] [R] Defining an objective function in fPortfolio

Lui ## lui.r.project at googlemail.com
Tue Jan 25 06:28:42 CET 2011

Hello Felipe,

I am not an expert in fPortfolio, so I can't tell you with 100%
certainty if its working or not. I tried for a while and didn't get it
running with the portfolio package. Maximizing the return is more
complex than the min Variance program...

I have two suggestions:

1. Create efficient frontier (with lets say 1000 or 2000 points) and
then determine a portfolio on that frontier which is closest to your
target sigma. The function could be

portspec <- portfolioSpec()
setNFrontierPoints (portspec) <- 2000
portfolio <- portfolioFrontier(DATA,portspec,"LongOnly")

Remember that you don't want to end up in the lower branch... :-)

2. Solve it with a heuristic (e.g. DEoptim - see my last thread). But
I just started using it.


On Mon, Jan 24, 2011 at 10:52 PM, Luis Felipe Parra
<felipe.parra at quantil.com.co> wrote:
> Hello I am using the fPortfolio package and I see there is the option in the
> model slot "objRisk" which permits the user to define its own objective
> function. I have the ebook Portfolio Optimization with Rmetrics and there it
> says examples on this option are on the advanced version of the book, which
> I looked on the Rmetrics webpage and apparently it doesn't exist yet. Does
> anybody have an example or knows where can I find an example of the usage of
> this option. How can I define my own objective function to optimize? Thank
> you
> Felipe Parra*
> *
>        [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-SIG-Finance mailing list