Example codes fPortfolio Package ?

View: New views
4 Messages — Rating Filter:   Alert me  

Example codes fPortfolio Package ?

by R@Nabble :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I was wondering whether there are more code-examples available for the above package. In particular, I'm interested in applications whereby:

1) One can define per asset the minW, maxW constraints.
(I tried ConstrLO = c("minW[1]=10","minW[2]=10","maxW[3]=15"), but I guess my interpretation of "vector of character strings" as described in the manual for the input here is wrong).
2) In addition to 1, add sector constraints (i.e. does one simply add it, like ConstrLO = c("minW[1]=10","minW[2]=10","maxW[3]=15", "minsumW[1:2]=50") ???)
3) One can add the benchmark portfolio within the analysis, in particular as a "dot" within the efficient frontier graph.
4) Assuming leverage, how to show a move along the cap.mkt line?

Any help/suggestions much appreciated.

Thx,

R@N

Re: [R-sig-finance] Example codes fPortfolio Package ?

by Diethelm Wuertz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

R@Nabble wrote:

> Hello,
>
> I was wondering whether there are more code-examples available for the above
> package. In particular, I'm interested in applications whereby:
>
> 1) One can define per asset the minW, maxW constraints.
> (I tried ConstrLO = c("minW[1]=10","minW[2]=10","maxW[3]=15"), but I guess
> my interpretation of "vector of character strings" as described in the
> manual for the input here is wrong).
> 2) In addition to 1, add sector constraints (i.e. does one simply add it,
> like ConstrLO = c("minW[1]=10","minW[2]=10","maxW[3]=15", "minsumW[1:2]=50")
> ???)
>  
Try just

c("minW[1]=0.10","minW[2]=0.10","maxW[3]=0.15") instead of


c("minW[1]=10","minW[2]=10","maxW[3]=15")


I think this should be made more explicit in the help file.

Have you looked in the unit test directory where you find douzans of
unit testing examples.

Diethelm


> 3) One can add the benchmark portfolio within the analysis, in particular as
> a "dot" within the efficient frontier graph.
> 4) Assuming leverage, how to show a move along the cap.mkt line?
>
> Any help/suggestions much appreciated.
>
> Thx,
>
> R@N
>  


--

PD Dr. Diethelm Wuertz
Institute for Theoretical Physics
Swiss Federal Institute of Technology

www.itp.phys.ethz.ch
www.rmetrics.org

NOTE:
Rmetrics Workshop: http://www.rmetrics.org/meielisalp.htm
June 29th - July 3rd Meielisalp, Lake Thune, Switzerland

_______________________________________________
R-SIG-Finance@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.

Re: [R-sig-finance] Example codes fPortfolio Package ?

by R@Nabble :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you Diethelm. That did the trick (and kind of obvious, should have tried myself), and I will have a look at those example files. Thanks for creating this library which I'm currently learning and intend to use a lot.

R@N
Diethelm Wuertz wrote:
R@Nabble wrote:
> Hello,
>
> I was wondering whether there are more code-examples available for the above
> package. In particular, I'm interested in applications whereby:
>
> 1) One can define per asset the minW, maxW constraints.
> (I tried ConstrLO = c("minW[1]=10","minW[2]=10","maxW[3]=15"), but I guess
> my interpretation of "vector of character strings" as described in the
> manual for the input here is wrong).
> 2) In addition to 1, add sector constraints (i.e. does one simply add it,
> like ConstrLO = c("minW[1]=10","minW[2]=10","maxW[3]=15", "minsumW[1:2]=50")
> ???)
>  
Try just

c("minW[1]=0.10","minW[2]=0.10","maxW[3]=0.15") instead of


c("minW[1]=10","minW[2]=10","maxW[3]=15")


I think this should be made more explicit in the help file.

Have you looked in the unit test directory where you find douzans of
unit testing examples.

Diethelm


> 3) One can add the benchmark portfolio within the analysis, in particular as
> a "dot" within the efficient frontier graph.
> 4) Assuming leverage, how to show a move along the cap.mkt line?
>
> Any help/suggestions much appreciated.
>
> Thx,
>
> R@N
>  


--

PD Dr. Diethelm Wuertz
Institute for Theoretical Physics
Swiss Federal Institute of Technology

www.itp.phys.ethz.ch
www.rmetrics.org

NOTE:
Rmetrics Workshop: http://www.rmetrics.org/meielisalp.htm
June 29th - July 3rd Meielisalp, Lake Thune, Switzerland

_______________________________________________
R-SIG-Finance@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.

Re: Example codes fPortfolio Package ?

by R@Nabble :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My previous questions below have been answered/are now clear. Still, a new one has occurred: how can I make sure that 2 or more assets get the same weights in the optimization?

Again, thx for any insights.

R@N
R@Nabble wrote:
Hello,

I was wondering whether there are more code-examples available for the above package. In particular, I'm interested in applications whereby:

1) One can define per asset the minW, maxW constraints.
(I tried ConstrLO = c("minW[1]=10","minW[2]=10","maxW[3]=15"), but I guess my interpretation of "vector of character strings" as described in the manual for the input here is wrong).
2) In addition to 1, add sector constraints (i.e. does one simply add it, like ConstrLO = c("minW[1]=10","minW[2]=10","maxW[3]=15", "minsumW[1:2]=50") ???)
3) One can add the benchmark portfolio within the analysis, in particular as a "dot" within the efficient frontier graph.
4) Assuming leverage, how to show a move along the cap.mkt line?

Any help/suggestions much appreciated.

Thx,

R@N
LightInTheBox - Buy quality products at wholesale price