<div dir="ltr">Professor Martin,<div><br></div><div>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.</div>
<div><br></div><div style>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.</div>
<div style><br></div><div style>As an example, here is a code snippet of how box constraints and group constraints are currently specified.</div><div style># General constraints object</div><div style># Box constraints of minimum weight = 0.1 and maximum weight = 0.5 for assets</div>
<div style>gen.constr <- constraint(assets = colnames(edhec), min=0.1, max =0.5, min_sum=1, max_sum=1)<br></div><div style><br></div><div style># Add group constraints to the gen.constr object</div><div style><div>groups <- c(3,3,3,4)</div>
<div>gen.constr$groups <- groups</div><div>gen.constr$cLO <- rep(0.15,length(groups))</div><div>gen.constr$cUP <- rep(0.30,length(groups))</div></div><div><br></div><div style>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.</div>
<div style><br></div><div style><div># Create the initial constraint object</div><div># Pass in a character vector of asset names for assets</div><div># Portfolio weights must sum to 1 (min_sum=1 and max_sum=1)</div><div>
gen.constr <- constraint(assets = colnames(edhec), min_sum=1, max_sum=1)</div></div><div><br></div><div><div># Add box constraints with asset weights greater than 0.1 and less than 0.5</div><div>gen.constr <- add.constraint(constraints=gen.constr, type="box",</div>
<div> min=0.1, max=0.5)</div></div><div><br></div><div><div># Group constraints for 10 assets</div><div># Separate assets into groups of 3, 3, and 4 assets</div><div># Specify the group weights as a vector</div>
<div># The first 3 assets shall have a group weight of greater than 0.15 and less than 0.3</div><div># The next 3 assets shall have a group weight of greater than 0.1 and less than 0.35</div><div># The last 4 assets shall have a group weight greater than 0 and less than 0.4</div>
<div>constr <- add.constraint(constraints=constr, type="group",</div><div> groups=c(3, 3, 4),</div><div> group_min=c(0.15, 0.1, 0),</div><div>
group_max=c(0.3, 0.35, 0.4))</div></div><div><br></div><div style>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.</div>
<div><br></div><div style>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.</div><div><br></div><div style>
Regards,</div><div style>Ross Bennett</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 5, 2013 at 9:23 AM, Doug Martin <span dir="ltr"><<a href="mailto:martinrd@comcast.net" target="_blank">martinrd@comcast.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Ross and all,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">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).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">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.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Doug<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:gsoc-porta-bounces@lists.r-forge.r-project.org" target="_blank">gsoc-porta-bounces@lists.r-forge.r-project.org</a> [mailto:<a href="mailto:gsoc-porta-bounces@lists.r-forge.r-project.org" target="_blank">gsoc-porta-bounces@lists.r-forge.r-project.org</a>] <b>On Behalf Of </b>Ross Bennett<br>
<b>Sent:</b> Wednesday, June 05, 2013 4:22 AM<br><b>To:</b> <a href="mailto:gsoc-porta@lists.r-forge.r-project.org" target="_blank">gsoc-porta@lists.r-forge.r-project.org</a><br><b>Subject:</b> [GSoC-PortA] Schedule for PortfolioAnalytics Coding<u></u><u></u></span></p>
<div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">All,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">In my GSOC proposal, the order of what components I planned to write code for was as follows:<u></u><u></u></p>
</div><div><ol start="1" type="1"><li class="MsoNormal">Utility Functions (print, summary, plot, etc.)<u></u><u></u></li><li class="MsoNormal">Constraints<u></u><u></u></li><li class="MsoNormal">Example Functionality<u></u><u></u></li>
</ol><div><p class="MsoNormal">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?<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thanks,<u></u><u></u></p></div><div><p class="MsoNormal">Ross Bennett<u></u><u></u></p></div></div></div></div></div></div></div><br>_______________________________________________<br>
GSoC-PortA mailing list<br>
<a href="mailto:GSoC-PortA@lists.r-forge.r-project.org">GSoC-PortA@lists.r-forge.r-project.org</a><br>
<a href="http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta" target="_blank">http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta</a><br>
<br></blockquote></div><br></div>