[GSoC-PortA] Schedule for PortfolioAnalytics Coding

Ross Bennett rossbennett34 at gmail.com
Thu Jun 6 13:54:41 CEST 2013


Professor Martin,

Thank you for the feedback. Based on the suggestions from yourself and
Brian Peterson, I will start with the constraints portion. I'll spend some
more time looking at Kirk Li's code to understand it better and think about
how to best integrate into PortfolioAnalytics. I should be able to use some
ideas from it.

I have been reviewing the code for PortfolioAnalytics and it seems that
there is already a lot of the infrastructure in place for the constraint
object and the optimizer so I don't want to maintain the interface to the
optimize.portfolio function as much as possible.

As an example, here is a code snippet of how box constraints and group
constraints are currently specified.
# General constraints object
# Box constraints of minimum weight = 0.1 and maximum weight = 0.5 for
assets
gen.constr <- constraint(assets = colnames(edhec), min=0.1, max =0.5,
min_sum=1, max_sum=1)

# Add group constraints to the gen.constr object
groups <- c(3,3,3,4)
gen.constr$groups <- groups
gen.constr$cLO <- rep(0.15,length(groups))
gen.constr$cUP <- rep(0.30,length(groups))

Following the outline on the GSOC2013 PortfolioAnalytics rwiki page, we
would remove box constraints from the constraint() function and create an
add.constraint() function to add/update box, group, and other constraint
types as applicable.

# Create the initial constraint object
# Pass in a character vector of asset names for assets
# Portfolio weights must sum to 1 (min_sum=1 and max_sum=1)
gen.constr <- constraint(assets = colnames(edhec), min_sum=1, max_sum=1)

# Add box constraints with asset weights greater than 0.1 and less than 0.5
gen.constr <- add.constraint(constraints=gen.constr, type="box",
                                          min=0.1, max=0.5)

# Group constraints for 10 assets
# Separate assets into groups of 3, 3, and 4 assets
# Specify the group weights as a vector
# The first 3 assets shall have a group weight of greater than 0.15 and
less than 0.3
# The next 3 assets shall have a group weight of greater than 0.1 and less
than 0.35
# The last 4 assets shall have a group weight greater than 0 and less than
0.4
constr <- add.constraint(constraints=constr, type="group",
                                    groups=c(3, 3, 4),
                                    group_min=c(0.15, 0.1, 0),
                                    group_max=c(0.3, 0.35, 0.4))

This keeps the constraint object and interface to optimize.portfolio()
consistent with the existing code, but simplifies it and makes adding box
and group constraints very similar.

I will continue to review the PortfolioAnalytics source code and we can
revisit this so that I can hit the ground running when finals are over and
start as soon as possible.

Regards,
Ross Bennett


On Wed, Jun 5, 2013 at 9:23 AM, Doug Martin <martinrd at comcast.net> wrote:

> Ross and all,****
>
> ** **
>
> I think starting with the constraints is a good idea.  But I think a
> review of where PortfolioAnalytics functionality is as of last year’s GSoC
> should be the first priority.  How planning on that week after next (Guy,
> Eric and I all have finals week to get out of the way next week).****
>
> ** **
>
> With regard to constraints, that approach that Kirk Li (UW Statistics
> Ph.D. student and AMATH 543 TA this spring) developed looks useful.  Ross
> you already have the code which I posted to the class web site.  I have
> attached it here for others on this project to have a look at.   Let’s
> review that after the end of next week when final exams and the spring
> quarter are completely behind us.****
>
> ** **
>
> Doug****
>
> ** **
>
> ** **
>
> *From:* gsoc-porta-bounces at lists.r-forge.r-project.org [mailto:
> gsoc-porta-bounces at lists.r-forge.r-project.org] *On Behalf Of *Ross
> Bennett
> *Sent:* Wednesday, June 05, 2013 4:22 AM
> *To:* gsoc-porta at lists.r-forge.r-project.org
> *Subject:* [GSoC-PortA] Schedule for PortfolioAnalytics Coding****
>
> ** **
>
> All,****
>
> ** **
>
> In my GSOC proposal, the order of what components I planned to write code
> for was as follows:****
>
>    1. Utility Functions (print, summary, plot, etc.)****
>    2. Constraints****
>    3. Example Functionality****
>
> In speaking with Brian Peterson at R/Finance, he suggested that the
> constraints portion be done first. I am fine with doing constraints first.
> Would you like me to submit a revised schedule and implementation plan with
> constraints first?****
>
> ** **
>
> Thanks,****
>
> Ross Bennett****
>
> _______________________________________________
> GSoC-PortA mailing list
> GSoC-PortA at lists.r-forge.r-project.org
> http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/gsoc-porta/attachments/20130606/becd7739/attachment.html>


More information about the GSoC-PortA mailing list