[R] Control number of assets in resulting portfolio with optimizations using package fPortfolio
Joshua Ulrich
josh.m.ulrich at gmail.com
Fri Feb 17 13:21:35 CET 2012
Alex,
You may find an answer to your question by searching the R-SIG-Finance
archives (via rseek.org). If not, you may want to consider asking
your question on the R-SIG-Finance list.
Best,
--
Joshua Ulrich | FOSS Trading: www.fosstrading.com
R/Finance 2012: Applied Finance with R
www.RinFinance.com
On Fri, Feb 17, 2012 at 12:53 AM, Enrico Schumann
<enricoschumann at yahoo.de> wrote:
>
> Hi Alex,
>
> I cannot say how to implement such constraints with fPortfolio, but in
> general you can use heuristics to solve such problems. An example for
> selecting a number of assets from a larger universe is given in a vignette
> of the NMOF package (of which I am the author) and in the code examples on
> http://nmof.net (even though they do not exactly cover your problem).
>
> Regards,
> Enrico
>
>
> Am 15.02.2012 20:18, schrieb Alexander Erbse:
>>
>> Dear All,
>>
>>
>>
>> I am using package fPortfolio to run minimum variance portfolio
>> optimizations in R. I already know how to set portfolioSpecs, portfolio
>> objects and constraints. Unfortunately I am not able to set the following
>> type of constraints.
>>
>> I have a timeSeries object with returns data for roughly 1.5k assets for
>> 261
>> subperiods (workingdays) and want to compute the global minimum variance
>> portfolio, considering following constraints:
>>
>>
>>
>> - Leverage = 1 (fully invested)
>>
>>
>>
>> - the lower / upper weights constraints (can be done by box
>> constraints) for individual assets are e.g. +0,01 / +0,04
>>
>>
>>
>> - and the problematic part: the minimum weights level for each
>> asset is +0,01 OR zero (in order to control outcome portfolio size)
>>
>>
>>
>> � Initially, considering that the minimum weight constraint is +0,01 for
>> each of the 1.500 assets and the sum of weights constraint (leverage)
>> equals
>> 1 would raise an infeasible problem for the optimizer. Given my additional
>> restriction that the minimum weight for any asset to get into the
>> portfolio
>> should be at least 0,01 would solve the target conflict in between minimum
>> asset weights and the leverage of 1. The iteration path of the optimizer
>> should consider something like this:
>>
>>
>>
>> ifelse(min(weight,0,01)<0,01,0,weight)
>>
>>
>>
>> �during the optimization. (iteratively)
>>
>>
>>
>> Is there any way to implement that sort of that constraint besides the
>> upper
>> / lower weight constraints (box constraints) in order to control for
>> decent
>> portfolio sizes?
>>
>>
>>
>> Thx& Regards,
>>
>> Alex
>>
>>
>> [[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.
>
>
> --
> Enrico Schumann
> Lucerne, Switzerland
> http://nmof.net/
>
> ______________________________________________
> 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-help
mailing list